58 lines
1.3 KiB
PHP
Executable file
58 lines
1.3 KiB
PHP
Executable file
<?php
|
|
|
|
namespace App\Http\Controllers\Settings;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use App\Models\Status;
|
|
use Request;
|
|
|
|
class BookingStatusController extends Controller
|
|
{
|
|
public function __construct()
|
|
{
|
|
$this->middleware('admin');
|
|
}
|
|
|
|
public function index($step = false)
|
|
{
|
|
$data = [
|
|
'status' => Status::all(),
|
|
];
|
|
return view('settings.status.index', $data);
|
|
}
|
|
|
|
|
|
public function update(){
|
|
|
|
$data = Request::all();
|
|
if($data['id'] === "new"){
|
|
$model = Status::create([
|
|
'name' => $data['name'],
|
|
'color' => $data['color'],
|
|
'handling_days' => $data['handling_days'],
|
|
]);
|
|
}else{
|
|
$model = Status::find($data['id']);
|
|
$model->name = $data['name'];
|
|
$model->color = $data['color'];
|
|
$model->handling_days = $data['handling_days'];
|
|
$model->save();
|
|
}
|
|
|
|
\Session()->flash('alert-save', '1');
|
|
return redirect(route('admin_settings_booking_status'));
|
|
}
|
|
|
|
public function delete($id){
|
|
|
|
$model = Status::findOrFail($id);
|
|
$model->delete();
|
|
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
|
return redirect()->back();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|