Ejemplo n.º 1
0
 /**
  * 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']]);
 }
Ejemplo n.º 2
0
 /**
  * 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');
 }
Ejemplo n.º 3
0
 public function destroy($id)
 {
     $object = Whale::find($id);
     $object->delete();
     return redirect('whale');
 }