last from 01 2019
This commit is contained in:
parent
f9fcaac838
commit
ed80b25b85
19 changed files with 626 additions and 341 deletions
65
app/Http/Controllers/Settings/TravelCountryController.php
Executable file
65
app/Http/Controllers/Settings/TravelCountryController.php
Executable file
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use HTMLHelper;
|
||||
use Input;
|
||||
|
||||
class TravelCountryController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'drafts' => Draft::all()->sortByDesc("id"),
|
||||
'draft_types' => DraftType::all()->sortByDesc("id"),
|
||||
'step' => $step
|
||||
];
|
||||
return view('drafts.index', $data);
|
||||
}
|
||||
|
||||
|
||||
public function store(){
|
||||
|
||||
$data = Input::all();
|
||||
if($data['id'] == "new"){
|
||||
$draft_type = DraftType::create([
|
||||
'name' => $data['name'],
|
||||
'active' => isset($data['active']) ? true : false,
|
||||
'color' => $data['color'],
|
||||
]);
|
||||
}else{
|
||||
$draft_type = DraftType::find($data['id']);
|
||||
$draft_type->name = $data['name'];
|
||||
$draft_type->active = isset($data['active']) ? true : false;
|
||||
$draft_type->color = $data['color'];
|
||||
|
||||
$draft_type->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('drafts', ['type']));
|
||||
|
||||
}
|
||||
public function delete($id){
|
||||
|
||||
if(DraftItem::where('draft_type_id', $id)->count()){
|
||||
\Session()->flash('alert-error', 'Eintrag wird verwendet');
|
||||
return redirect(route('drafts'));
|
||||
}
|
||||
$draft_type = DraftType::findOrFail($id);
|
||||
$draft_type->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect(route('drafts', ['type']));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue