1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-27 02:06:52 +00:00
pixelfed/app/Observer/UserObserver.php

25 lines
467 B
PHP
Raw Normal View History

<?php
namespace App\Observers;
use App\{Profile, User};
class UserObserver
{
/**
* Listen to the User created event.
*
* @param \App\User $user
* @return void
*/
public function saved(User $user)
{
if($user->has('profile')->count() == 0) {
$profile = new Profile;
$profile->user_id = $user->id;
$profile->username = $user->username;
$profile->save();
}
}
}