Esempio n. 1
0
 public function store(CreateCountryRequest $req, Country $Country)
 {
     $country = $Country->fill($req->all())->save();
     $message = trans('lists::countries.create_success');
     if (request('submit') == 'save') {
         return redirect()->back()->with('success', $message);
     } else {
         return redirect()->route('countries.index')->with('success', $message);
     }
 }
Esempio n. 2
0
 public function store(CreateCountryRequest $req, Country $Country)
 {
     //$country = $Country->fill($req->all());
     $input = $req->except('status');
     $Country = $Country->fill($input);
     $Country->status = $req->has('status') ? $req->get('status') : 0;
     if ($Country->status) {
         // only one countries can be status
         //update set all countries not status
         Country::where('status', 1)->update(['status' => 0]);
     }
     $Country->save();
     $message = trans('lists::countries.create_success', ['name' => $Country->name]);
     if (request('submit') == 'save') {
         return redirect()->back()->with('success', $message);
     } else {
         return redirect()->route('countries.index')->with('success', $message);
     }
 }