You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
595 B
PHTML
30 lines
595 B
PHTML
|
10 years ago
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* TelegramSession Model
|
||
|
|
*/
|
||
|
|
|
||
|
|
class TelegramSession extends Model
|
||
|
|
{
|
||
|
|
protected $connection = "default";
|
||
|
|
protected $table = "telegram_session";
|
||
|
|
|
||
|
|
public function datetime()
|
||
|
|
{
|
||
|
|
return date("Y-m-d H:i:s", $this->attributes['datetime']);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function User()
|
||
|
|
{
|
||
|
|
$user = User::where("id", $this->attributes['user_id'])->first();
|
||
|
|
if ($user == null) {
|
||
|
|
Ticket::where('id', '=', $this->attributes['id'])->delete();
|
||
|
|
return null;
|
||
|
|
} else {
|
||
|
|
return $user;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|