Closed cod3rshotout closed 2 years ago
Hi,
Are you using the latest version ?
@sebastienheyd yes, also I noticed that since the latest version I doesn't have any filters on the DataTables columns
You don't have filters because you set buttons([])
.
As you can see in Datatable.php - ln. 34, filters
is set by default.
Also in the latest version of UsersDatatable.php - ln. 16, $userModel
is equal to config('boilerplate.auth.providers.users.model')
Are you sure you have the latest version? Also check your overloads if you have any.
You don't have filters because you set
buttons([])
.As you can see in Datatable.php - ln. 34,
filters
is set by default.Also in the latest version of UsersDatatable.php - ln. 16,
$userModel
is equal toconfig('boilerplate.auth.providers.users.model')
Are you sure you have the latest version? Also check your overloads if you have any.
I guess I found the problem about the $userModel
, I've executed the scaffhold
command to customize the boilerplate, but seems that some files like UsersDatatable
aren't inserted in my solution (I don't know if it was wanted or was it an oversight?)
So in UsersDatatable
I have:
use Sebastienheyd\Boilerplate\Models\User;
class UsersDatatable extends Datatable
{
public $slug = 'users';
public function datasource()
{
$userModel = config('boilerplate.auth.providers.users.model');
and in myapp/config/boilerplate/auth
I have:
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\Boilerplate\User::class,
'table' => 'users',
],
],
which is the model scaffholded (different from what the UsersDatatable
class is loading). That's why I have this exception, I can fix this copying the UsersDatatable
file in myapp/app/Datatables
, but I suppose that if I call the scaffhold command this file should be automatically copied in there, agree with me?
Yes, you're right. Databables folder is not copied and it must be.
Ok, one more fix :)
Fixed in 7.11.4
Hi,
If you browse the route:
/admin/users
, you will get this error:which is caused by that line:
@if(in_array('filters', $datatable->buttons))
, in particularUsersDatatable
doesn't have any buttons, so this will throw an exception, I temporary fixed this using:Also, I guess that this line:
$userModel = config('boilerplate.laratrust.user.providers.users.model');
should be:
$userModel = config('boilerplate.laratrust.user');
otherwise this will throw a type exception on ajax load