/** * A basic test example. * * @return void */ public function testDatabaseDelete() { Session::start(); $faker = Faker\Factory::create(); $data = ['identity' => $faker->randomDigit, 'firstname' => $faker->firstName, 'lastname' => $faker->lastName, 'sex' => 'Male', 'fruit' => $faker->word, 'hobby' => $faker->word]; $new = Whale::create($data); $token = ['_token' => csrf_token()]; $this->call('DELETE', '/whale/' . $new->id, $token); $this->dontSeeInDatabase('whales', ['identity' => $data['identity']]); }
/** * Delete id model and redirect * * @param type $id current number * * @return main page */ public function destroy($id) { $object = Whale::find($id); $object->delete(); \Session::flash('flash_message', 'This whale has been deleted :('); return redirect('whale'); }
public function destroy($id) { $object = Whale::find($id); $object->delete(); return redirect('whale'); }