1
0
Fork 0
pixelfed/app/Listeners/AuthLogin.php

41 lines
716 B
PHP

<?php
namespace App\Listeners;
use DB;
use App\User;
use App\UserSetting;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class AuthLogin
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param object $event
* @return void
*/
public function handle($event)
{
$user = $event->user;
if (empty($user->settings)) {
DB::transaction(function() use($user) {
UserSetting::firstOrCreate([
'user_id' => $user->id
]);
});
}
}
}