2020-02-12 01:41:17 +01:00
|
|
|
<?php
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2020-02-12 01:41:17 +01:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2023-01-28 23:21:40 +01:00
|
|
|
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
|
2020-02-12 01:41:17 +01:00
|
|
|
*
|
2021-06-16 08:58:16 +02:00
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
2020-02-12 01:41:17 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2023-09-22 14:08:57 +02:00
|
|
|
use App\Services\Template\TemplateService;
|
2020-02-12 01:41:17 +01:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
|
2023-03-08 08:33:42 +01:00
|
|
|
/**
|
|
|
|
* App\Models\Design
|
|
|
|
*
|
|
|
|
* @property int $id
|
|
|
|
* @property int|null $user_id
|
|
|
|
* @property int|null $company_id
|
|
|
|
* @property string $name
|
2023-10-13 12:35:22 +02:00
|
|
|
* @property bool $is_custom
|
|
|
|
* @property bool $is_active
|
2023-03-08 08:33:42 +01:00
|
|
|
* @property object|null $design
|
2023-10-13 12:35:22 +02:00
|
|
|
* @property bool $is_deleted
|
|
|
|
* @property bool $is_template
|
2023-03-08 08:33:42 +01:00
|
|
|
* @property int|null $created_at
|
|
|
|
* @property int|null $updated_at
|
|
|
|
* @property int|null $deleted_at
|
|
|
|
* @property-read \App\Models\Company|null $company
|
2023-10-05 12:47:24 +02:00
|
|
|
* @property-read string $hashed_id
|
2023-03-08 08:33:42 +01:00
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel company()
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel exclude($columns)
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design filter(\App\Filters\QueryFilters $filters)
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design newModelQuery()
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design newQuery()
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design onlyTrashed()
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design query()
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel scope()
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design whereCompanyId($value)
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design whereCreatedAt($value)
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design whereDeletedAt($value)
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design whereDesign($value)
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design whereId($value)
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design whereIsActive($value)
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design whereIsCustom($value)
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design whereIsDeleted($value)
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design whereName($value)
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design whereUpdatedAt($value)
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design whereUserId($value)
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design withTrashed()
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Design withoutTrashed()
|
|
|
|
* @mixin \Eloquent
|
|
|
|
*/
|
2020-02-12 01:41:17 +01:00
|
|
|
class Design extends BaseModel
|
|
|
|
{
|
2020-02-28 22:57:47 +01:00
|
|
|
use Filterable;
|
|
|
|
use SoftDeletes;
|
|
|
|
|
2020-02-17 21:07:32 +01:00
|
|
|
protected $casts = [
|
|
|
|
'design' => 'object',
|
2020-02-28 22:57:47 +01:00
|
|
|
'deleted_at' => 'timestamp',
|
2020-02-17 21:07:32 +01:00
|
|
|
'updated_at' => 'timestamp',
|
|
|
|
'created_at' => 'timestamp',
|
|
|
|
];
|
|
|
|
|
2020-02-28 22:57:47 +01:00
|
|
|
protected $fillable = [
|
|
|
|
'name',
|
|
|
|
'design',
|
|
|
|
'is_active',
|
2023-09-22 06:46:14 +02:00
|
|
|
'is_template',
|
2023-10-04 06:29:31 +02:00
|
|
|
'entities',
|
2020-02-28 22:57:47 +01:00
|
|
|
];
|
|
|
|
|
2020-02-12 01:41:17 +01:00
|
|
|
public function company()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Company::class);
|
|
|
|
}
|
2023-09-22 14:08:57 +02:00
|
|
|
|
|
|
|
public function service(): TemplateService
|
|
|
|
{
|
2023-09-27 13:32:17 +02:00
|
|
|
return (new TemplateService($this))->setCompany($this->company);
|
2023-09-22 14:08:57 +02:00
|
|
|
}
|
2020-03-21 06:37:30 +01:00
|
|
|
}
|