Mails
This commit is contained in:
parent
68b9d1ff88
commit
b9c26d06d0
75 changed files with 2143 additions and 818 deletions
|
|
@ -1,86 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\CMS;
|
||||
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\CMSContent;
|
||||
use App\Models\TravelCountry;
|
||||
use App\Models\TravelNationality;
|
||||
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 = 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(!isset($data['contact_lands'])){
|
||||
$data['contact_lands'] = null;
|
||||
}
|
||||
$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