FileManager
This commit is contained in:
parent
c8948338bb
commit
f1e0900a7a
131 changed files with 5844 additions and 3081 deletions
60
app/Http/Controllers/Settings/KeywordController.php
Executable file
60
app/Http/Controllers/Settings/KeywordController.php
Executable file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\Keyword;
|
||||
use App\Models\TravelAgenda;
|
||||
use Request;
|
||||
|
||||
class KeywordController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'keywords' => Keyword::all(),
|
||||
];
|
||||
return view('settings.keywords.index', $data);
|
||||
}
|
||||
|
||||
|
||||
public function update(){
|
||||
|
||||
$data = Request::all();
|
||||
if($data['id'] === "new"){
|
||||
$model = Keyword::create([
|
||||
'name' => $data['name'],
|
||||
]);
|
||||
}else{
|
||||
$model = Keyword::find($data['id']);
|
||||
$model->name = $data['name'];
|
||||
$model->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_keyword'));
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
//TODO check ist linked
|
||||
/*if(Booking::where('travelagenda_id', $id)->count()){
|
||||
\Session()->flash('alert-error', 'Eintrag wird verwendet');
|
||||
return redirect()->back();
|
||||
}*/
|
||||
$model = Keyword::findOrFail($id);
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue