2020-01-20 11:10:33 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2020-10-28 11:10:49 +01:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
2020-01-20 11:10:33 +01:00
|
|
|
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
|
|
|
|
2020-01-20 11:10:33 +01:00
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $dates = ['deleted_at'];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $fillable = [
|
|
|
|
'name',
|
2020-10-08 00:25:39 +02:00
|
|
|
'client_id',
|
2020-01-20 11:10:33 +01:00
|
|
|
'task_rate',
|
|
|
|
'private_notes',
|
2020-10-08 00:25:39 +02:00
|
|
|
'public_notes',
|
2020-01-20 11:10:33 +01:00
|
|
|
'due_date',
|
|
|
|
'budgeted_hours',
|
|
|
|
'custom_value1',
|
|
|
|
'custom_value2',
|
2020-10-08 00:25:39 +02:00
|
|
|
'custom_value3',
|
|
|
|
'custom_value4',
|
2020-10-29 01:09:51 +01:00
|
|
|
'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
|
|
|
];
|
2020-01-20 11:10:33 +01:00
|
|
|
|
2020-05-06 13:49:42 +02:00
|
|
|
public function getEntityType()
|
|
|
|
{
|
2020-09-06 11:38:10 +02:00
|
|
|
return self::class;
|
2020-05-06 13:49:42 +02:00
|
|
|
}
|
|
|
|
|
2020-07-23 05:55:11 +02:00
|
|
|
protected $touches = [];
|
2020-07-16 13:01:39 +02:00
|
|
|
|
2020-01-20 11:10:33 +01:00
|
|
|
/**
|
2020-10-28 11:10:49 +01:00
|
|
|
* @return BelongsTo
|
2020-01-20 11:10:33 +01:00
|
|
|
*/
|
|
|
|
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');
|
|
|
|
}
|
|
|
|
|
2021-02-16 10:02:33 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2020-01-20 11:10:33 +01:00
|
|
|
}
|