public function test_index_returns_lessons_by_get()
 {
     Lesson::where('id', '>=', 1)->delete();
     $lessons = factory(Lesson::class, 3)->create();
     $this->get('api/v1/lesson');
     $this->seeStatusCode(200);
     foreach ($lessons as $lesson) {
         $this->seeJson(['name' => $lesson->name]);
     }
 }
示例#2
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $id = $this->route('lesson');
     return Lesson::where('id', $id)->exists();
 }