mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Add AuthLoginEvent
This commit is contained in:
parent
bde6c0f1ff
commit
46bc5322f3
2 changed files with 39 additions and 0 deletions
36
app/Events/AuthLoginEvent.php
Normal file
36
app/Events/AuthLoginEvent.php
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Events;
|
||||||
|
|
||||||
|
use Illuminate\Broadcasting\Channel;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
|
use Illuminate\Broadcasting\PresenceChannel;
|
||||||
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||||
|
use App\{User, UserSetting};
|
||||||
|
|
||||||
|
class AuthLoginEvent
|
||||||
|
{
|
||||||
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new event instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle(User $user)
|
||||||
|
{
|
||||||
|
if(empty($user->settings)) {
|
||||||
|
$settings = new UserSetting;
|
||||||
|
$settings->user_id = $user->id;
|
||||||
|
$settings->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,9 @@ class EventServiceProvider extends ServiceProvider
|
||||||
'App\Events\Event' => [
|
'App\Events\Event' => [
|
||||||
'App\Listeners\EventListener',
|
'App\Listeners\EventListener',
|
||||||
],
|
],
|
||||||
|
'auth.login' => [
|
||||||
|
'App\Events\AuthLoginEvent',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue