Пример #1
0
 public function run()
 {
     $faker = Factory::create();
     //Chop::truncate();
     foreach (range(1, 50) as $index) {
         Chop::create(['chops_name' => $faker->word, 'about' => $faker->text, 'user_id' => $faker->numberBetween(1, 50), 'likes' => $faker->numberBetween(1, 50)]);
     }
 }
Пример #2
0
 public function testChopsCanBeUpdated()
 {
     $id = $this->createChops();
     $chops = Chop::find($id);
     $chops->chops_name = "A new name";
     $chops->save();
     $this->tester->seeRecord('chops', ['chops_name' => 'A new name']);
     $this->tester->dontSeeRecord('chops', ['chops_name' => 'Random name']);
 }
Пример #3
0
 public function testCommentCanBeDeleted()
 {
     $chops_id = $this->createChops();
     $chops = \ChopBox\Chop::find($chops_id);
     $id = $this->tester->haveRecord('comments', ['comment' => "this comment has to be deleted", 'user_id' => $chops->user_id, 'chops_id' => $chops->id]);
     $comment = \ChopBox\Comment::find($id);
     $comment->delete();
     $this->tester->dontSeeRecord('comments', ['comment' => 'this comment has to be deleted']);
 }
Пример #4
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $chops = Chop::paginate(8);
     return view('chops.home')->with('chops', $chops);
 }