2019-09-12 03:28:41 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2019-09-12 03:28:41 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-09-12 03:28:41 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
class StaticModel extends Model
|
|
|
|
{
|
2019-09-26 00:27:26 +02:00
|
|
|
protected $casts = [
|
|
|
|
'updated_at' => 'timestamp',
|
|
|
|
'created_at' => 'timestamp',
|
|
|
|
'deleted_at' => 'timestamp',
|
|
|
|
];
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2019-12-30 22:59:12 +01:00
|
|
|
protected $dateFormat = 'Y-m-d H:i:s.u';
|
2019-09-27 06:31:13 +02:00
|
|
|
|
2019-09-12 03:28:41 +02:00
|
|
|
public function getIdAttribute()
|
|
|
|
{
|
2020-09-06 11:38:10 +02:00
|
|
|
return (string) $this->attributes['id'];
|
2019-09-12 03:28:41 +02:00
|
|
|
}
|
|
|
|
|
2019-11-27 10:47:59 +01:00
|
|
|
/*
|
|
|
|
V2 type of scope
|
|
|
|
*/
|
|
|
|
public function scopeCompany($query)
|
|
|
|
{
|
|
|
|
$query->where('company_id', auth()->user()->companyId());
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2019-11-27 10:47:59 +01:00
|
|
|
return $query;
|
|
|
|
}
|
2019-09-12 03:28:41 +02:00
|
|
|
}
|