コード例 #1
0
 public function testReturnEmptyParamValue()
 {
     $request = m::mock(Request::class);
     $request->shouldReceive('route')->once()->with()->andReturn([0 => 1, 1 => [], 2 => []]);
     $this->app->instance('request', $request);
     $this->assertNull(RouteHelper::parameter('foo'));
 }
コード例 #2
0
 /**
  * Get the account from routing
  *
  * @return Account|null
  */
 private function getAccountFromRouting()
 {
     //Get account uuid from route
     $accountUuid = RouteHelper::parameter('account');
     //If we have account id, return the account from uuid
     if (!empty($accountUuid)) {
         return $this->accountRepository->findByUuid($accountUuid);
     }
     //Get account slug from route
     $accountSlug = RouteHelper::parameter('accountSlug');
     //If we have account slug, return the account from the slug
     if (!empty($accountSlug)) {
         return $this->accountRepository->findBySlug($accountSlug);
     }
     return null;
 }