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