當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Account::forCurrentUser方法代碼示例

本文整理匯總了PHP中app\models\Account::forCurrentUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP Account::forCurrentUser方法的具體用法?PHP Account::forCurrentUser怎麽用?PHP Account::forCurrentUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\models\Account的用法示例。


在下文中一共展示了Account::forCurrentUser方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: it_displays_an_account

 /**
  * @test
  * @return void
  */
 public function it_displays_an_account()
 {
     $this->logInUser();
     $account = Account::forCurrentUser()->first();
     $response = $this->call('GET', '/api/accounts/' . $account->id);
     $content = json_decode($response->getContent(), true);
     $this->checkAccountKeysExist($content);
     //        $this->assertEquals($this->user->id, $content['user_id']);
     $this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
 }
開發者ID:JennySwift,項目名稱:budget,代碼行數:14,代碼來源:AccountsShowTest.php

示例2: it_can_update_an_existing_account

 /**
  * @test
  * @return void
  */
 public function it_can_update_an_existing_account()
 {
     $this->logInUser();
     $account = Account::forCurrentUser()->first();
     $response = $this->call('PUT', '/api/accounts/' . $account->id, ['name' => 'numbat']);
     $content = json_decode($response->getContent(), true);
     $this->checkAccountKeysExist($content);
     $this->assertEquals('numbat', $content['name']);
     $this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
 }
開發者ID:JennySwift,項目名稱:budget,代碼行數:14,代碼來源:AccountsUpdateTest.php

示例3: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     //		$router->model('accounts', Account::class);
     Route::bind('accounts', function ($id) {
         return Account::forCurrentUser()->findOrFail($id);
     });
     Route::bind('budgets', function ($id) {
         return Budget::forCurrentUser()->findOrFail($id);
     });
     Route::bind('transactions', function ($id) {
         return Transaction::forCurrentUser()->findOrFail($id);
     });
     Route::bind('favouriteTransactions', function ($id) {
         return FavouriteTransaction::forCurrentUser()->findOrFail($id);
     });
     Route::bind('savedFilters', function ($id) {
         return SavedFilter::forCurrentUser()->findOrFail($id);
     });
 }
開發者ID:JennySwift,項目名稱:budget,代碼行數:26,代碼來源:RouteServiceProvider.php

示例4: index

 /**
  *
  * @param Request $request
  * @return Response
  */
 public function index(Request $request)
 {
     $accounts = Account::forCurrentUser()->orderBy('name', 'asc')->get();
     $accounts = $this->transform($this->createCollection($accounts, new AccountTransformer(['includeBalance' => $request->get('includeBalance')])))['data'];
     return response($accounts, Response::HTTP_OK);
 }
開發者ID:JennySwift,項目名稱:budget,代碼行數:11,代碼來源:AccountsController.php


注:本文中的app\models\Account::forCurrentUser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。