I create a table with php artisan make:migration
command. After that i edit the migration file to put the columns and insert standard data.
After i run php migrate:referesh
command and all good, i go to the database and the table is there with a correct name and data.
In database the table name is rolesStems.
I create a model like this:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class RolesStems extends Model
{
protected $fillable = ['id', 'value', 'order', 'active','id_stem', 'id_role'];
}
And in my controller i do this:
use App\RolesStems as RolesStem;
RolesStem::select('value')->where('active', '=', 1)->where('id_stem', '=', 1)->orderBy('id_role', 'asc')->get());
And i have this error:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'dbname.roles_stems' doesn't exist (SQL: select `value` from `roles_stems` where `active` = 1 and `id_stem` = 1 order by `id_role` asc)
It put a unknown table name roles_stems, why?
I do this to other table, the same way, but with this table this happens.
What is the problem?