private function seedUsersEndpoints()
 {
     $users = Api::where('name', '=', 'users')->first();
     // endpoints scopes
     ApiEndpoint::create(array('name' => 'get-user-info', 'active' => true, 'api_id' => $users->id, 'route' => '/api/v1/users/me', 'http_method' => 'GET'));
     $profile_scope = ApiScope::where('name', '=', 'profile')->first();
     $email_scope = ApiScope::where('name', '=', 'email')->first();
     $address_scope = ApiScope::where('name', '=', 'address')->first();
     $get_user_info_endpoint = ApiEndpoint::where('name', '=', 'get-user-info')->first();
     $get_user_info_endpoint->scopes()->attach($profile_scope->id);
     $get_user_info_endpoint->scopes()->attach($email_scope->id);
     $get_user_info_endpoint->scopes()->attach($address_scope->id);
 }
Exemple #2
0
 private function seedConsultantsEndpoints()
 {
     $consultants = Api::where('name', '=', 'consultants')->first();
     $current_realm = Config::get('app.url');
     // endpoints scopes
     ApiEndpoint::create(array('name' => 'get-consultants', 'active' => true, 'api_id' => $consultants->id, 'route' => '/api/v1/marketplace/consultants', 'http_method' => 'GET'));
     ApiEndpoint::create(array('name' => 'get-consultant', 'active' => true, 'api_id' => $consultants->id, 'route' => '/api/v1/marketplace/consultants/{id}', 'http_method' => 'GET'));
     ApiEndpoint::create(array('name' => 'get-consultant-offices', 'active' => true, 'api_id' => $consultants->id, 'route' => '/api/v1/marketplace/consultants/{id}/offices', 'http_method' => 'GET'));
     $consultant_read_scope = ApiScope::where('name', '=', sprintf('%s/consultants/read', $current_realm))->first();
     $endpoint = ApiEndpoint::where('name', '=', 'get-consultants')->first();
     $endpoint->scopes()->attach($consultant_read_scope->id);
     $endpoint = ApiEndpoint::where('name', '=', 'get-consultant')->first();
     $endpoint->scopes()->attach($consultant_read_scope->id);
     $endpoint = ApiEndpoint::where('name', '=', 'get-consultant-offices')->first();
     $endpoint->scopes()->attach($consultant_read_scope->id);
 }