mirror of
https://github.com/axeloz/filesharing.git
synced 2025-05-06 01:53:55 +02:00
Now keeping last user connection date
This commit is contained in:
parent
2fed92653f
commit
7fa06d74fd
2 changed files with 9 additions and 0 deletions
|
@ -6,6 +6,7 @@ use Exception;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
class Auth {
|
class Auth {
|
||||||
|
|
||||||
|
@ -35,6 +36,10 @@ class Auth {
|
||||||
// OK, user's credentials are OK
|
// OK, user's credentials are OK
|
||||||
session()->put('username', $username);
|
session()->put('username', $username);
|
||||||
session()->put('authenticated', true);
|
session()->put('authenticated', true);
|
||||||
|
|
||||||
|
$user->connected_at = Carbon::now();
|
||||||
|
$user->save();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
|
|
|
@ -32,6 +32,9 @@ class User extends Authenticatable
|
||||||
'password',
|
'password',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'connected_at' => 'datetime',
|
||||||
|
];
|
||||||
|
|
||||||
public $incrementing = false;
|
public $incrementing = false;
|
||||||
|
|
||||||
|
@ -50,6 +53,7 @@ class User extends Authenticatable
|
||||||
{
|
{
|
||||||
$table->string('username');
|
$table->string('username');
|
||||||
$table->string('password');
|
$table->string('password');
|
||||||
|
$table->timestamp('connected_at')->nullable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function bundles() {
|
public function bundles() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue