This commit is contained in:
Adrian Hopek
2022-03-21 13:53:33 +01:00
parent dafc17b14c
commit c5dffa60e9
3 changed files with 7 additions and 8 deletions

View File

@@ -4,11 +4,18 @@ declare(strict_types=1);
namespace Toby\Eloquent\Observers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use Toby\Eloquent\Models\User;
use Toby\Eloquent\Models\YearPeriod;
class UserObserver
{
public function creating(User $user): void
{
$user->password = Hash::make(Str::random(40));
}
public function created(User $user): void
{
$yearPeriods = YearPeriod::all();