Exemplo n.º 1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $data = Persons::find($id);
     if ($data) {
         if (Items::hasUser($data->id)->first()) {
             return $this->error("there is still an item allocated to his person");
         } else {
             $data->delete();
             return $this->success($data);
         }
     } else {
         return $this->error("No item with this id");
     }
 }