File Controller, Booking Organisation, import Draft, old arrangements
This commit is contained in:
parent
4eb83def39
commit
8fd1f4d451
289 changed files with 36649 additions and 10877 deletions
|
|
@ -27,11 +27,11 @@ class TravelCompanyController extends Controller
|
|||
|
||||
public function detail($id, $step = false)
|
||||
{
|
||||
if($id === "new") {
|
||||
if ($id == "new") {
|
||||
$model = new TravelCompany();
|
||||
$id = 'new';
|
||||
$model->active = 1;
|
||||
}else{
|
||||
} else {
|
||||
$model = TravelCompany::findOrFail($id);
|
||||
$id = $model->id;
|
||||
}
|
||||
|
|
@ -45,20 +45,21 @@ class TravelCompanyController extends Controller
|
|||
return view('settings.travel_company.detail', $data);
|
||||
}
|
||||
|
||||
public function update($id){
|
||||
public function update($id)
|
||||
{
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
|
||||
if(isset($data['update-action'])){
|
||||
if($data['update-action'] === 'save-travel-company-service'){
|
||||
$data['active'] = true;//isset($data['active']) ? true : false;
|
||||
if (isset($data['update-action'])) {
|
||||
if ($data['update-action'] === 'save-travel-company-service') {
|
||||
$data['active'] = true; //isset($data['active']) ? true : false;
|
||||
$travel_company = TravelCompany::findOrFail($id);
|
||||
$data['travel_company_id'] = $travel_company->id;
|
||||
|
||||
if($data['travel_company_service_id'] === 'new'){
|
||||
if ($data['travel_company_service_id'] === 'new') {
|
||||
$model = TravelCompanyService::create($data);
|
||||
}else{
|
||||
} else {
|
||||
$model = TravelCompanyService::find($data['travel_company_service_id']);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
|
|
@ -69,9 +70,9 @@ class TravelCompanyController extends Controller
|
|||
}
|
||||
|
||||
$data['contact_emails'] = isset($data['contact_emails']) ? Util::_explodeLines($data['contact_emails']) : null;
|
||||
if($id === "new"){
|
||||
if ($id === "new") {
|
||||
$model = TravelCompany::create($data);
|
||||
}else{
|
||||
} else {
|
||||
$model = TravelCompany::find($id);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
|
|
@ -79,12 +80,12 @@ class TravelCompanyController extends Controller
|
|||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_travel_company_detail', [$model->id, $data['action']]));
|
||||
|
||||
}
|
||||
|
||||
public function delete($id, $del="travel_company"){
|
||||
public function delete($id, $del = "travel_company")
|
||||
{
|
||||
|
||||
if($del === 'travel_country') {
|
||||
if ($del === 'travel_country') {
|
||||
abort(404, 'Noch keine Funktion');
|
||||
$model = TravelCompany::findOrFail($id);
|
||||
$model->delete();
|
||||
|
|
@ -92,11 +93,11 @@ class TravelCompanyController extends Controller
|
|||
return redirect()->back();
|
||||
}
|
||||
|
||||
if($del === 'company_service'){
|
||||
if ($del === 'company_service') {
|
||||
$service = TravelCompanyService::findOrFail($id);
|
||||
$travel_company = $service->travel_company;
|
||||
//check as entry
|
||||
if($service->booking_company_services->count() > 0){
|
||||
if ($service->booking_company_services->count() > 0) {
|
||||
\Session()->flash('alert-error', 'Die Leistung kann nicht gelöscht werden, diese hat Einträge bei den Buchungen');
|
||||
return redirect(route('admin_settings_travel_company_detail', [$travel_company->id, 'services']));
|
||||
}
|
||||
|
|
@ -105,7 +106,4 @@ class TravelCompanyController extends Controller
|
|||
return redirect(route('admin_settings_travel_company_detail', [$travel_company->id, 'services']));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue