app\models\Article::getFirstChildAttribute PHP Метод

getFirstChildAttribute() публичный Метод

public getFirstChildAttribute ( ) : Article
Результат Article
    public function getFirstChildAttribute() : Article
    {
        if (!$this->hasChildren()) {
            throw new Exception("Article `{$this->id}` doesn't have any children.");
        }
        return $this->children->sortBy('order_column')->first();
    }