Example #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function update($id)
 {
     // Get the resource if it has not been provided by the child class
     if (!$this->resource->getKey()) {
         $this->resource = $this->resource->findOrFail($id);
     }
     // NOTE: If you override this method remember to exclude $this->relationships from input!!
     $input = Input::except(array_keys($this->relationships));
     // Less safe, more convenient
     // Transfer input to the resource
     $this->resource = $this->resource->fill($input);
     return $this->persist(__FUNCTION__);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $data = Model::findOrFail($id);
     $data->delete();
     return redirect()->route('routename')->with('status', 'Successfully Deleted');
 }