Не могу понять, где сидит ошибка:
<?php
namespace App\Models\Users;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Hash;
class User extends Authenticatable
{
use HasFactory, Notifiable;
protected $fillable = [];
protected $guarded = [];
protected $hidden = [
'password',
'remember_token',
];
public function setPasswordAttribute($value)
{
$this->attributes['password'] = Hash::make($value);
}
public function setPhoneAttribute($value)
{
$this->attributes['phone'] = preg_replace('/[^0-9]/', '', $value);
}
}
<?php
namespace App\Observers\Users;
use App\Models\Users\User;
class UserObserver
{
public function creating(User $user)
{
dd($user);
}
<?php
namespace App\Providers;
use App\Models\Users\User;
use App\Observers\Users\UserObserver;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
UserObserver::observe(User::class);
}
}
На выходе ошибка:
Пути вроде верные, может глаз уже "замылился".