invoiceninja/app/Models/Project.php

82 lines
1.4 KiB
PHP
Raw Normal View History

<?php
namespace App\Models;
2020-10-28 21:10:49 +11:00
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Laracasts\Presenter\PresentableTrait;
/**
* Class Project.
*/
class Project extends BaseModel
{
use SoftDeletes;
use PresentableTrait;
2020-10-08 09:25:39 +11:00
use Filterable;
2020-10-28 21:10:49 +11:00
/**
* @var array
*/
protected $dates = ['deleted_at'];
/**
* @var array
*/
protected $fillable = [
'name',
2020-10-08 09:25:39 +11:00
'client_id',
'task_rate',
'private_notes',
2020-10-08 09:25:39 +11:00
'public_notes',
'due_date',
'budgeted_hours',
'custom_value1',
'custom_value2',
2020-10-08 09:25:39 +11:00
'custom_value3',
'custom_value4',
'assigned_user_id',
2021-01-05 15:41:43 +11:00
'color',
2021-03-20 11:16:29 +11:00
'number',
2020-01-21 11:32:34 +11:00
];
public function getEntityType()
{
return self::class;
}
2020-07-23 13:55:11 +10:00
protected $touches = [];
/**
2020-10-28 21:10:49 +11:00
* @return BelongsTo
*/
public function company()
{
return $this->belongsTo(Company::class);
}
/**
* @return mixed
*/
public function client()
{
return $this->belongsTo(Client::class)->withTrashed();
}
2020-10-12 08:34:02 +11:00
public function documents()
{
return $this->morphMany(Document::class, 'documentable');
}
public function user()
{
return $this->belongsTo(User::class)->withTrashed();
}
2021-02-24 13:12:23 +11:00
public function tasks()
{
return $this->hasMany(Task::class);
}
}