src/user/models/User.php
public function getNotifications()
    {
        if ($this instanceof RESTUser) {
            return $this->hasMany(RESTDatabaseNotification::class, ['notifiable_id' => 'id'])
                ->onCondition(['notifiable_class' => self::class])
                ->addOrderBy(['created_at' => SORT_DESC]);
        } else {
            return $this->hasMany(DatabaseNotification::class, ['notifiable_id' => 'id'])
                ->onCondition(['notifiable_class' => self::class])
                ->addOrderBy(['created_at' => SORT_DESC]);
        }
    }
public function getNotifications()
    {
        if ($this instanceof RESTUser) {
            return $this->hasMany(RESTDatabaseNotification::class, ['notifiable_id' => 'id'])
                ->onCondition(['notifiable_class' => self::class])
                ->addOrderBy(['created_at' => SORT_DESC]);
        } else {
            return $this->hasMany(DatabaseNotification::class, ['notifiable_id' => 'id'])
                ->onCondition(['notifiable_class' => self::class])
                ->addOrderBy(['created_at' => SORT_DESC]);
        }
    }
public function getNotifications ( ) { if ( $ this instanceof RESTUser ) { return $ this -> hasMany ( RESTDatabaseNotification :: class , [ 'notifiable_id' => 'id' ] ) -> onCondition ( [ 'notifiable_class' => self :: class ] ) -> addOrderBy ( [ 'created_at' => SORT_DESC ] ) ; } else { return $ this -> hasMany ( DatabaseNotification :: class , [ 'notifiable_id' => 'id' ] ) -> onCondition ( [ 'notifiable_class' => self :: class ] ) -> addOrderBy ( [ 'created_at' => SORT_DESC ] ) ; } }
Get the entity's notifications.
@return \yii\db\ActiveQuery
Get the entity s notifications .