pixelfed/app/Events/AuthLoginEvent.php

34 lines
644 B
PHP
Raw Normal View History

2018-07-23 17:29:20 +00:00
<?php
namespace App\Events;
2018-08-28 03:07:36 +00:00
use App\User;
use App\UserSetting;
2018-07-23 17:29:20 +00:00
use Illuminate\Broadcasting\InteractsWithSockets;
2018-08-28 03:07:36 +00:00
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
2018-07-23 17:29:20 +00:00
class AuthLoginEvent
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct()
{
//
}
public function handle(User $user)
{
2018-08-28 03:07:36 +00:00
if (empty($user->settings)) {
$settings = new UserSetting();
2018-07-23 17:29:20 +00:00
$settings->user_id = $user->id;
$settings->save();
}
}
}