Travel Guide Frontend Backend
This commit is contained in:
parent
e6cc042aee
commit
0857a34766
681 changed files with 6680 additions and 1689 deletions
57
app/Http/Controllers/Settings/CategoryController.php
Executable file
57
app/Http/Controllers/Settings/CategoryController.php
Executable file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\IQContentCategory;
|
||||
use App\Services\Util;
|
||||
use Request;
|
||||
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'airline' => IQContentCategory::all(),
|
||||
];
|
||||
return view('settings.category.index', $data);
|
||||
}
|
||||
|
||||
|
||||
public function update(){
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
|
||||
$data['active'] = isset($data['active']) ? true : false;
|
||||
|
||||
if($data['id'] === "new"){
|
||||
$model = IQContentCategory::create($data);
|
||||
}else{
|
||||
$model = IQContentCategory::find($data['id']);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_categories'));
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
//TODO check ist linked
|
||||
|
||||
$model = IQContentCategory::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