public function delete($id)
 {
     $activity = TypeModel::find($id);
     if (!$activity) {
         return response()->json(['message' => 'Activity with given id not found'], 404);
     }
     $activity->delete();
     return response()->json(['message' => 'Activity deleted'], 200);
 }
示例#2
0
 /**
  * Truncates Table
  *
  * @return boolean
  */
 public function truncate()
 {
     DB::transaction(function () {
         TypeModel::truncate();
     });
 }
示例#3
0
 public function test_it_empty_the_types_table()
 {
     (new Type())->truncate();
     $this->assertEquals(0, TypeModel::count());
 }
示例#4
0
 /**
  * Check if type with id $id exists
  *
  * @param $id
  * @return bool
  */
 public function typeExists($id)
 {
     return is_null(TypeModel::find($id)) ? false : true;
 }