当前位置: 首页>>代码示例>>PHP>>正文


PHP Api::where方法代码示例

本文整理汇总了PHP中Api::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::where方法的具体用法?PHP Api::where怎么用?PHP Api::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Api的用法示例。


在下文中一共展示了Api::where方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: seedUsersScopes

 private function seedUsersScopes()
 {
     $users = Api::where('name', '=', 'users')->first();
     ApiScope::create(array('name' => 'profile', 'short_description' => 'Allows access to your profile info.', 'description' => 'This scope value requests access to the End-Users default profile Claims, which are: name, family_name, given_name, middle_name, nickname, preferred_username, profile, picture, website, gender, birthdate, zoneinfo, locale, and updated_at.', 'api_id' => $users->id, 'system' => false));
     ApiScope::create(array('name' => 'email', 'short_description' => 'Allows access to your email info.', 'description' => 'This scope value requests access to the email and email_verified Claims.', 'api_id' => $users->id, 'system' => false));
     ApiScope::create(array('name' => 'address', 'short_description' => 'Allows access to your Address info.', 'description' => 'This scope value requests access to the address Claim.', 'api_id' => $users->id, 'system' => false));
 }
开发者ID:smarcet,项目名称:openstackid,代码行数:7,代码来源:ApiScopeSeeder.php

示例2: testCreate

 /**
  * testCreate
  * @covers create a new api scope
  */
 public function testCreate()
 {
     $api = Api::where('name', '=', 'api-endpoint')->first();
     $this->assertTrue(!is_null($api));
     $data = array('name' => 'https://test-scope/read.only', 'description' => 'test scope.', 'short_description' => 'test scope.', 'active' => true, 'system' => true, 'default' => true, 'api_id' => $api->id);
     $response = $this->action("POST", "ApiScopeController@create", $data, array(), array(), array());
     $content = $response->getContent();
     $json_response = json_decode($content);
     $this->assertResponseStatus(201);
     $this->assertTrue(isset($json_response->scope_id) && !empty($json_response->scope_id));
 }
开发者ID:smarcet,项目名称:openstackid,代码行数:15,代码来源:ApiScopeTest.php

示例3: seedUsersEndpoints

 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);
 }
开发者ID:smarcet,项目名称:openstackid,代码行数:13,代码来源:ApiEndpointSeeder.php

示例4: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     $public_clouds = Api::where('name', '=', 'public-clouds')->first();
     if ($public_clouds) {
         $public_clouds->delete();
     }
     $private_clouds = Api::where('name', '=', 'private-clouds')->first();
     if ($private_clouds) {
         $private_clouds->delete();
     }
     $consultants = Api::where('name', '=', 'consultants')->first();
     if ($consultants) {
         $consultants->delete();
     }
 }
开发者ID:smarcet,项目名称:openstackid,代码行数:20,代码来源:2015_05_06_142958_delete_marketplace_api_endpoints_scopes.php

示例5: seedConsultantsEndpoints

 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);
 }
开发者ID:smarcet,项目名称:openstackid,代码行数:16,代码来源:2015_03_19_190534_insert_marketplace_api_endpoints_scopes.php

示例6: testUpdateStatus

 public function testUpdateStatus()
 {
     $api = Api::where('name', '=', 'api-endpoint')->first();
     $this->assertTrue(!is_null($api));
     $data = array('name' => 'test-api-endpoint', 'description' => 'test api endpoint, allows test api endpoints.', 'active' => true, 'route' => '/api/v1/api-endpoint/test', 'http_method' => 'POST', 'api_id' => $api->id, 'allow_cors' => true, 'rate_limit' => 60);
     $response = $this->action("POST", "ApiEndpointController@create", $data);
     $this->assertResponseStatus(201);
     $content = $response->getContent();
     $json_response = json_decode($content);
     $this->assertTrue(isset($json_response->api_endpoint_id) && !empty($json_response->api_endpoint_id));
     $new_id = $json_response->api_endpoint_id;
     //update status
     $response = $this->action('DELETE', "ApiEndpointController@deactivate", array('id' => $new_id));
     $this->assertResponseStatus(200);
     $content = $response->getContent();
     $json_response = json_decode($content);
     $this->assertTrue($json_response === 'ok');
     $response = $this->action("GET", "ApiEndpointController@get", array('id' => $new_id));
     $this->assertResponseStatus(200);
     $content = $response->getContent();
     $updated_values = json_decode($content);
     $this->assertTrue($updated_values->active == false);
 }
开发者ID:smarcet,项目名称:openstackid,代码行数:23,代码来源:ApiEndpointTest.php

示例7: testDeleteExisting

 public function testDeleteExisting()
 {
     $resource_server_api = Api::where('name', '=', 'resource-server')->first();
     $id = $resource_server_api->id;
     $response = $this->action("DELETE", "ApiController@delete", $parameters = array('id' => $id), array(), array(), array());
     $this->assertResponseStatus(204);
     $response = $this->action("GET", "ApiController@get", $parameters = array('id' => $id), array(), array(), array());
     $this->assertResponseStatus(404);
 }
开发者ID:smarcet,项目名称:openstackid,代码行数:9,代码来源:ApiTest.php


注:本文中的Api::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。