Flarum\Event\PrepareApiData::isController PHP Method

isController() public method

public isController ( string $controller ) : boolean
$controller string
return boolean
    public function isController($controller)
    {
        return $this->controller instanceof $controller;
    }

Usage Example

Example #1
0
 /**
  * @param PrepareApiData $event
  */
 public function loadTagsRelationship(PrepareApiData $event)
 {
     // Expose the complete tag list to clients by adding it as a
     // relationship to the /api/forum endpoint. Since the Forum model
     // doesn't actually have a tags relationship, we will manually load and
     // assign the tags data to it using an event listener.
     if ($event->isController(ShowForumController::class)) {
         $event->data['tags'] = Tag::whereVisibleTo($event->actor)->with('lastDiscussion')->get();
     }
 }
All Usage Examples Of Flarum\Event\PrepareApiData::isController