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 'App\Role' 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 Illuminate\Database\Eloquent\Model;
class Role extends Model
{
//
protected $fillable = [
'name',
];
public function users()
{
return $this->belongsToMany('App\User');
}
}
Its been pointed out to me its probably a namespace issue but everyting else seems to point to Laravel like RoleController has:
namespace Laravel\Http\Controllers;
use Laravel\Role;
use Illuminate\Http\Request;
and user model has:
namespace Laravel;
So Why is this not working for me? as far as I can tell everything is named right.
namespace App;