1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-16 08:02:40 +01:00
invoiceninja/app/Models/Design.php

87 lines
3.2 KiB
PHP
Raw Normal View History

<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2024-04-12 06:15:41 +02:00
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
2021-06-16 08:58:16 +02:00
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Models;
2023-09-22 14:08:57 +02:00
use App\Services\Template\TemplateService;
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
*/
class Design extends BaseModel
{
use Filterable;
use SoftDeletes;
2020-02-17 21:07:32 +01:00
protected $casts = [
'design' => 'object',
'deleted_at' => 'timestamp',
2020-02-17 21:07:32 +01:00
'updated_at' => 'timestamp',
'created_at' => 'timestamp',
];
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',
];
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
}
}