コード例 #1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param int $id
  * @param CountryRepository $countries
  * @return Response
  */
 public function edit($id, CountryRepository $countries)
 {
     try {
         $country = $countries->findById($id);
         return view('countries.edit')->with('model', $country);
     } catch (ModelNotFoundException $e) {
         flash()->warning(trans('countries.not_found'));
         return redirect()->route('country.index');
     }
 }
コード例 #2
0
 /**
  * Execute the command.
  *
  * @param CountryRepository $countries
  * @return Country
  */
 public function handle(CountryRepository $countries)
 {
     $country = $countries->findById($this->id)->fill($this->getProperties());
     $countries->save($country);
     return $country;
 }