예제 #1
0
 public function test_index_returns_all_users_by_get()
 {
     User::where('id', '>=', 1)->delete();
     $users = factory(User::class, 3)->create();
     $user = $users->first();
     //$this->actingAs($user);
     $this->get('api/v1/user');
     $this->seeStatusCode(200);
     $this->seeJson(['per_page' => 50]);
     foreach ($users as $user) {
         $this->seeJson(['username' => $user->username]);
     }
 }
예제 #2
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $id = $this->route('user');
     return User::where('id', $id)->exists();
 }