php - Laravel class 'UserRole' not found

Solution:

Add a namespace to your model

namespace App;

Should look like this:

<?php

namespace App;

use \Illuminate\Database\Eloquent\Model as Eloquent;

class UserRole extends Eloquent
{
    public $table = 'role';
    public $primaryKey = 'id_role';
    public $timestamps = false;

    const ADMIN = 1;
    const OPERATOR = 2;
    const CUSTOMER = 3;
}

Answer

Solution:

You should add in your model

namespace App;

Source