Natinality, Country, Agenda, search Request. CMS
Magazine Content
This commit is contained in:
parent
30d5ca3b44
commit
aebfb0586a
72 changed files with 4636 additions and 590 deletions
65
app/Http/Controllers/Settings/TravelNationalityController.php
Executable file
65
app/Http/Controllers/Settings/TravelNationalityController.php
Executable file
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\TravelCountry;
|
||||
use App\Models\TravelNationality;
|
||||
use App\Models\TravelNationalityRequirement;
|
||||
use Carbon\Carbon;
|
||||
use HTMLHelper;
|
||||
use Input;
|
||||
|
||||
class TravelNationalityController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'travel_nationality' => TravelNationality::all(),
|
||||
];
|
||||
return view('settings.travel_nationality.index', $data);
|
||||
}
|
||||
|
||||
|
||||
public function update(){
|
||||
|
||||
$data = Input::all();
|
||||
if($data['id'] == "new"){
|
||||
$model = TravelNationality::create([
|
||||
'name' => $data['name'],
|
||||
'active' => isset($data['active']) ? true : false,
|
||||
]);
|
||||
}else{
|
||||
$model = TravelNationality::find($data['id']);
|
||||
$model->name = $data['name'];
|
||||
$model->active = isset($data['active']) ? true : false;
|
||||
$model->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_travel_nationality'));
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
|
||||
if(TravelNationalityRequirement::where('travel_nationality_id', $id)->count()){
|
||||
\Session()->flash('alert-error', 'Eintrag wird verwendet');
|
||||
return redirect()->back();
|
||||
}
|
||||
$model = TravelNationality::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