Mail and Booking
This commit is contained in:
parent
62e84637b6
commit
5daea268f7
250 changed files with 5377 additions and 1473 deletions
70
app/Http/Controllers/Settings/AirlineController.php
Executable file
70
app/Http/Controllers/Settings/AirlineController.php
Executable file
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\Airline;
|
||||
use App\Models\Booking;
|
||||
use Request;
|
||||
|
||||
class AirlineController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'airline' => Airline::all(),
|
||||
];
|
||||
return view('settings.airline.index', $data);
|
||||
}
|
||||
|
||||
|
||||
public function update(){
|
||||
|
||||
$data = Request::all();
|
||||
if(isset($data['contact_emails'])){
|
||||
$data['contact_emails'] = explode('#', str_replace(array("\r\n", "\r", "\n"),"#",$data['contact_emails']));
|
||||
}else{
|
||||
$data['contact_emails'] = null;
|
||||
}
|
||||
if($data['id'] === "new"){
|
||||
$model = Airline::create($data);
|
||||
}else{
|
||||
$model = Airline::find($data['id']);
|
||||
$model->name = $data['name'];
|
||||
$model->name_full = $data['name_full'];
|
||||
$model->contact_emails = $data['contact_emails'];
|
||||
$model->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_airline'));
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
//TODO check ist linked
|
||||
/*if(Booking::where('travelagenda_id', $id)->count()){
|
||||
\Session()->flash('alert-error', 'Eintrag wird verwendet');
|
||||
return redirect()->back();
|
||||
}*/
|
||||
|
||||
$model = Airline::findOrFail($id);
|
||||
|
||||
if(Booking::where('airline_id', $model->id)->count()){
|
||||
\Session()->flash('alert-error', 'Fehler: Airline in Buchnungen verwendet.');
|
||||
return redirect()->back();
|
||||
}
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue