Exemplo n.º 1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     try {
         $magazine = Magazine::findOrFail($id);
     } catch (ModelNotFoundException $e) {
         $errMsg = "Cannot edit magazine. Error on ID={$id}";
         return redirect("masterdata/magazine")->with('errMsg', $errMsg);
     }
     return view('masterdata/magazine-form', ['magazine' => $magazine, 'publishers' => Publisher::all(), 'method' => 'PUT', 'form_action' => action('MagazineController@update', $id), 'magz_id' => $id]);
 }
Exemplo n.º 2
0
 /**
  * Remove the specified publisher from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     try {
         $pub = Publisher::findOrFail($id);
         $pub->delete();
         //Set result message as flashdata
         $execMsg = "Deletion successful!";
     } catch (ModelNotFoundException $e) {
         //In case of failure on deletion/finding data, set errMsg
         $execMsg = "Cannot delete record. Data not found.";
         return redirect('masterdata/publisher')->with('errMsg', $execMsg);
     }
     return redirect('masterdata/publisher')->with('message', $execMsg);
 }