I'm using Laravel Nova 4 (Laravel 10.43.0, PHP 8.2.8).
When using soft deletion, I get the error Column not found: 1054 Unknown column '*.deleted_at'
, where *
is the table of the entity for which I use it.
Full SQL request in the exception:
select * from `users` where `id` = 1 and `users`.`deleted_at` is null limit 1
If I execute this query in the SQL console in PhpStorm, it will say that there is no such column, but the query itself will execute and do it correctly. An example of an implementation with a user.
Migration:
// ...
Schema::create('users', function (Blueprint $table) {
// ...
$table->softDeletes();
// ...
});
Model:
// ...
class User extends Authenticatable
{
// ...
use SoftDeletes;
// ...
}
The source of the problem has been found. There were three files in the root of my project: .env
, .env.local
, .env.prod
, the last two were used by the console command to quickly change the environment. After I put the .env.*
files in a separate folder, the application began to work like clockwork.