IQ Reisebausteine bis Gruppe
This commit is contained in:
parent
6880c7e989
commit
9baa1a6233
43 changed files with 2206 additions and 24 deletions
58
app/Http/Controllers/Settings/TravelPlaceController.php
Normal file
58
app/Http/Controllers/Settings/TravelPlaceController.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\IQContentCategory;
|
||||
use App\Models\TravelPlace;
|
||||
use App\Services\Util;
|
||||
use Request;
|
||||
|
||||
class TravelPlaceController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'travel_places' => TravelPlace::all(),
|
||||
];
|
||||
return view('settings.place.index', $data);
|
||||
}
|
||||
|
||||
|
||||
public function update(){
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
|
||||
$data['active'] = isset($data['active']) ? true : false;
|
||||
|
||||
if($data['id'] === "new"){
|
||||
$model = TravelPlace::create($data);
|
||||
}else{
|
||||
$model = TravelPlace::find($data['id']);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_travel_places'));
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
//TODO check ist linked
|
||||
|
||||
$model = TravelPlace::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