getSubject() public method

Get the model that is the subject of this activity.
public getSubject ( ) : AbstractModel | null
return Flarum\Database\AbstractModel | null
Beispiel #1
0
 /**
  * Construct an array of attributes to be stored in a notification record in
  * the database, given a notification blueprint.
  *
  * @param BlueprintInterface $blueprint
  * @return array
  */
 protected function getAttributes(BlueprintInterface $blueprint)
 {
     return ['type' => $blueprint::getType(), 'sender_id' => ($sender = $blueprint->getSender()) ? $sender->id : null, 'subject_id' => ($subject = $blueprint->getSubject()) ? $subject->id : null, 'data' => ($data = $blueprint->getData()) ? json_encode($data) : null];
 }