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.
Malio/app/Models/Bought.php

36 lines
737 B
PHTML

9 years ago
<?php
namespace App\Models;
class Bought extends Model
{
protected $connection = 'default';
protected $table = 'bought';
9 years ago
public function renew_date()
{
return date('Y-m-d H:i:s', $this->attributes['renew']);
9 years ago
}
public function datetime()
{
return date('Y-m-d H:i:s', $this->attributes['datetime']);
9 years ago
}
9 years ago
public function user()
{
$user = User::where('id', $this->attributes['userid'])->first();
9 years ago
if ($user == null) {
self::where('id', '=', $this->attributes['id'])->delete();
9 years ago
return null;
}
return $user;
9 years ago
}
9 years ago
public function shop()
{
return Shop::where('id', $this->attributes['shopid'])->first();
9 years ago
}
}