try:
accessibleSlugs change to:
accessible_slugs
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
So as the title states, I was having problems with running php artisan. Checking the laravel.log brought me to my custom HtmlBuilder:
class HtmlBuilder extends \Collective\Html\HtmlBuilder {
function __construct()
{
$this->accessibleSlugs = auth()->user()->accessibleSlugs;
}
//in the Admin model...
public function getAccessibleSlugsAttribute()
{
return static::$roleSlugs[$this->role];
}
When I comment the line out, php artisan works properly again. Weird thing is this code runs fine, and I am also using this in a routeMiddleware where it doesn't cause problems to php artisan. Basicly accessing anything on the authenticated user's model, from within the HtmlBuilder's contstruct, breaks artisan. But when I did some further digging, this seemed to work..
function __construct()
{
$this->accessibleSlugs = auth()->user()['accessibleSlugs'];
}
I have no idea why I should use [] instead of -> , It seemed to be a proper Admin model instance. Hopefully someone here can give me some direction to why this is happening ;)
Please or to participate in this conversation.