Esempio n. 1
0
 /**
  * 
  * @param type $authService
  * @param type $em
  * @param \App\MvcEvent $e
  * @return type
  */
 public function tryHttpAuth($authService, $em, MvcEvent $e)
 {
     $resolver = new DoctrineResolver($em, '\\Aaa\\Entity\\User');
     $adapter = new Http(['realm' => 'Max', 'accept_schemes' => 'basic']);
     $adapter->setBasicResolver($resolver);
     $adapter->setRequest($e->getRequest());
     // zato da se ne pošiljajo http auth challenge nastavimo novi response, ki
     // ne vpliva na pravi response
     $adapter->setResponse(new Response());
     // shranim si doctrine adapter
     $originalAdapter = $authService->getAdapter();
     $authService->setAdapter($adapter);
     /* @var $authService AuthenticationService */
     $authResult = $authService->authenticate();
     if ($authResult->isValid()) {
         $identity = $authResult->getIdentity();
         $authService->getStorage()->write($identity);
     } else {
         $authService->setAdapter($originalAdapter);
         $identity = null;
     }
     return $identity;
 }
Esempio n. 2
0
 /**
  * Process relationships
  * 
  * @param type $query
  * @return object
  */
 public function scopeRelationships($query)
 {
     return $query->with('adverts');
 }
Esempio n. 3
0
 /**
  * Process relationships
  * 
  * @param type $query
  * @return object
  */
 public function scopeRelationships($query)
 {
     return $query->with('images', 'images.imagecategories', 'advertlocations');
 }
Esempio n. 4
0
 /**
  * Show book of publish book.
  *
  * @param type $query description
  *
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public function scopeBookPublish($query)
 {
     $query->join('book_author', 'book_author.author_id', '=', 'users.id')->join('books', 'books.id', '=', 'book_author.book_id')->where('book_author.is_main', 1)->where('books.is_published', 1)->where('users.id', $this->id)->select(['books.id', 'books.title', 'books.bookurl', 'books.diravatar']);
     return $query;
 }