pixelfed/app/Listeners/AuthLogin.php
Daniel Supernault c6b1164620
Update AuthLogin
2018-10-24 12:41:14 -06:00

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
]);
});
}
}
}