06 2022
This commit is contained in:
parent
34a3d2196b
commit
93d1bea8e3
45 changed files with 1601 additions and 573 deletions
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\TravelGerneralNote;
|
||||
use Request;
|
||||
|
||||
class TravelGerneralNotesController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware(['superadmin', '2fa']);
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'gerneral_notes' => TravelGerneralNote::all(),
|
||||
];
|
||||
return view('settings.gerneral_notes.index', $data);
|
||||
}
|
||||
|
||||
public function update(){
|
||||
$data = Request::all();
|
||||
if($data['id'] === "new"){
|
||||
$model = TravelGerneralNote::create([
|
||||
'name' => $data['name'],
|
||||
'text' => $data['text']
|
||||
]);
|
||||
}else{
|
||||
$model = TravelGerneralNote::find($data['id']);
|
||||
$model->name = $data['name'];
|
||||
$model->text = $data['text'];
|
||||
$model->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_gerneral_notes'));
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
$model = TravelGerneralNote::findOrFail($id);
|
||||
if($model->travel_programs->count() > 0){
|
||||
\Session()->flash('alert-error', 'Eintrag wird bei Reiseprogrammen verwendet');
|
||||
return redirect()->back();
|
||||
}
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue