mirror of https://github.com/pixelfed/pixelfed
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
467 B
PHP
25 lines
467 B
PHP
<?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();
|
|
}
|
|
}
|
|
|
|
} |