first commit

This commit is contained in:
denisdulici
2017-09-14 22:21:00 +03:00
commit 515bdaf5cd
598 changed files with 48030 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Listeners\Auth;
use Auth;
use Illuminate\Auth\Events\Login as ILogin;
class Login
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param Logout $event
* @return void
*/
public function handle(ILogin $event)
{
// Get company
$company = Auth::user()->companies()->first();
session(['company_id' => $company->id]);
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Listeners\Auth;
use Jenssegers\Date\Date;
use Illuminate\Auth\Events\Logout as ILogout;
class Logout
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param Logout $event
* @return void
*/
public function handle(ILogout $event)
{
if (empty($event->user)) {
return;
}
$event->user->last_logged_in_at = Date::now();
$event->user->save();
session()->forget('company_id');
}
}