You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the instructions for installing the spatie roles and permissions package no longer works with Laravel 7.25 due to framework changes in detecting fillable columns in a recent security patch.
To summarise:
Laravel now checks the database table associated with a model to detect fillable columns (when using $guarded instead of explicit $fillable)
The spatie Role model uses $guarded = ['id'] to make all other columns on the table implicitly fillable
The PrefixAllTableNames-trait for Hyn prefixes table names with the database/connection name
As a result, the Role model for this package, as well as other models with the same setup, do not work when using fillables. Eg.
Role::create(['name' => 'Foo']); yields an SQL error column 'name' cannot be NULL
I was able to get the fillables working by removing the PrefixAllTableNames-trait, but this leads to errors further down, because in for example subqueries the table name isn't prefixed with the correct connection.
Information
hyn/multi-tenant version: latest
laravel version:7.27.0
database driver and version: MySQL 5.7
webserver software and version: Nginx 1.17
php version: 7.2
The text was updated successfully, but these errors were encountered:
Description
Following the instructions for installing the spatie roles and permissions package no longer works with Laravel 7.25 due to framework changes in detecting fillable columns in a recent security patch.
To summarise:
$guarded = ['id']
to make all other columns on the table implicitly fillableRole::create(['name' => 'Foo']);
yields an SQL errorcolumn 'name' cannot be NULL
I was able to get the fillables working by removing the
PrefixAllTableNames
-trait, but this leads to errors further down, because in for example subqueries the table name isn't prefixed with the correct connection.Information
The text was updated successfully, but these errors were encountered: