This is default behavior. The table is, after all, a table of multiple users, not just one user.
Usign Eloquent - 's' is added to database table names
I am following this tutorial: https://www.youtube.com/watch?v=_s6K-3KT5wQ
And working on my first Laravel App.
But I have noticed that when I create a new class file (in this case "App\UserInfo"
and then try to pull information to the controller it adds an 's' to the end of the table name. Just wondering if anybody has any idea as to why it is doing this?
Here is the error: (I am trying to work with the table "UserInfo" and instead it seems to be looking for "UserInfos"
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'app.UserInfos' doesn't exist (SQL: select * from UserInfos)
use Illuminate\Database\Eloquent\Model as Eloquent;
class UserInfo extends Eloquent {
}
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests; use App\Http\Controllers\Controller;
use App\UserInfo
class UserInfoController extends Controller { public function index() {
$users = UserInfo::get();
return view('dashboard.users.list', compact('users'));
}
}
Please or to participate in this conversation.