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

82 lines
1.4 KiB
PHP
Raw Normal View History

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