コード例 #1
0
ファイル: Post.php プロジェクト: hnykda/ushadi-prod-platform
 protected function selectQuery(array $where = [])
 {
     $query = parent::selectQuery($where);
     // Join to messages and load message id
     $query->join('messages', 'LEFT')->on('posts.id', '=', 'messages.post_id')->select(['messages.id', 'message_id'], ['messages.type', 'source']);
     return $query;
 }
コード例 #2
0
ファイル: PostValue.php プロジェクト: pablodivino/platform
 protected function selectQuery(array $where = [])
 {
     $query = parent::selectQuery($where);
     // Select 'key' too
     $query->select($this->getTable() . '.*', 'form_attributes.key')->join('form_attributes')->on('form_attribute_id', '=', 'form_attributes.id');
     return $query;
 }
コード例 #3
0
ファイル: User.php プロジェクト: nolanglee/platform
 public function update(Entity $entity)
 {
     $state = ['updated' => time()];
     if ($entity->hasChanged('password')) {
         $state['password'] = $this->hasher->hash($entity->password);
     }
     return parent::update($entity->setState($state));
 }
コード例 #4
0
ファイル: Notification.php プロジェクト: gjorgiev/platform
 public function create(Entity $entity)
 {
     $id = $this->getId($entity);
     if ($id) {
         // No need to insert a new record.
         // Instead return the id of the notification that exists
         return $id;
     }
     $state = ['user_id' => $entity->user_id, 'created' => time()];
     return parent::create($entity->setState($state));
 }
コード例 #5
0
ファイル: Queue.php プロジェクト: puffadder/platform
 public function create(Entity $entity)
 {
     $state = ['created' => time()];
     return parent::create($entity->setState($state));
 }
コード例 #6
0
ファイル: Form.php プロジェクト: gjorgiev/platform
 public function update(Entity $entity)
 {
     return parent::update($entity->setState(['updated' => time()]));
 }
コード例 #7
0
ファイル: Set.php プロジェクト: gjorgiev/platform
 /**
  * Override selectQuery to enforce filtering by search=0/1
  */
 protected function selectQuery(array $where = [])
 {
     $query = parent::selectQuery($where);
     $query->where('search', '=', (int) $this->savedSearch);
     return $query;
 }
コード例 #8
0
ファイル: Media.php プロジェクト: gjorgiev/platform
 public function __construct(Database $db, Uploader $upload)
 {
     parent::__construct($db);
     $this->upload = $upload;
 }