Monday, March 19, 2018

Laravel namespace class error - development

Laravel namespace class error

Trying to learn how to get a role name from the role table by linking it to the user table with role_id in user table and user_id in the role table.

I’m getting this error

Class 'AppRole' not found (View: C:

All of my Role related files all reference role and files are names, RoleController and Role.php with a view called index.blade.php.

heres my role class:

<?php

namespace Laravel;

use IlluminateDatabaseEloquentModel;

class Role extends Model
{
//

protected $fillable = [
'name',
];

public function users()
{
return $this->belongsToMany('AppUser');
}

}

Its been pointed out to me its probably a namespace issue but everyting else seems to point to Laravel like RoleController has:

namespace LaravelHttpControllers;

use LaravelRole;
use IlluminateHttpRequest;

and user model has:

namespace Laravel;

So Why is this not working for me? as far as I can tell everything is named right.



from Laravel Questions and Answers https://laravelquestions.com/php/laravel-namespace-class-error/
via Lzo Media

No comments:

Post a Comment