Booking, QI Content, Trees, Media
This commit is contained in:
parent
1f340e96fa
commit
7fbac395a9
260 changed files with 27160 additions and 3773 deletions
80
app/Http/Controllers/CMS/CMSContentCountryController.php
Executable file
80
app/Http/Controllers/CMS/CMSContentCountryController.php
Executable file
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\CMS;
|
||||
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\CMSContent;
|
||||
use App\Models\TravelCountry;
|
||||
use App\Models\TravelNationality;
|
||||
use Input;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
|
||||
class CMSContentCountryController extends Controller
|
||||
{
|
||||
|
||||
/*
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'travel_countries' => TravelCountry::all(),
|
||||
];
|
||||
return view('cms.content.country.index', $data);
|
||||
}
|
||||
|
||||
public function detail($id, $step = false)
|
||||
{
|
||||
$model = TravelCountry::findOrFail($id);
|
||||
$id = $model->id;
|
||||
|
||||
$data = [
|
||||
'model' => $model,
|
||||
'id' => $id,
|
||||
'step' => $step,
|
||||
'travel_nationalities' => TravelNationality::where('active', true)->get(),
|
||||
];
|
||||
return view('cms.content.country.detail', $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function store($id)
|
||||
{
|
||||
|
||||
$data = Input::all();
|
||||
|
||||
$model = TravelCountry::findOrFail($id);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
|
||||
//travel_nationality_requirement
|
||||
if (isset($data['travel_nationality_requirement'])) {
|
||||
foreach ($data['travel_nationality_requirement'] as $travel_nationality_id => $text) {
|
||||
$model->setNationalityRequirement($travel_nationality_id, $text);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO for this time
|
||||
if ($data['action'] == 'contact') {
|
||||
//we need an update in the old CRM v1 system DB
|
||||
$tc = \App\Models\Sym\TravelCountry::findOrFail($model->crm_id);
|
||||
$tc->fill($data);
|
||||
$tc->save();
|
||||
}
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('cms_content_country_detail', [$model->id, $data['action']]));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue