mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
185 lines
7.9 KiB
PHP
185 lines
7.9 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Laracasts\Presenter\PresentableTrait;
|
|
|
|
/**
|
|
* Class Project.
|
|
*
|
|
* @property int $id
|
|
* @property int $user_id
|
|
* @property int|null $assigned_user_id
|
|
* @property int $company_id
|
|
* @property int|null $client_id
|
|
* @property string $name
|
|
* @property string $task_rate
|
|
* @property string|null $due_date
|
|
* @property string|null $private_notes
|
|
* @property string $budgeted_hours
|
|
* @property string|null $custom_value1
|
|
* @property string|null $custom_value2
|
|
* @property string|null $custom_value3
|
|
* @property string|null $custom_value4
|
|
* @property int|null $created_at
|
|
* @property int|null $updated_at
|
|
* @property int|null $deleted_at
|
|
* @property string|null $public_notes
|
|
* @property int $is_deleted
|
|
* @property string|null $number
|
|
* @property string $color
|
|
* @property-read \App\Models\Client|null $client
|
|
* @property-read \App\Models\Company $company
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
|
|
* @property-read int|null $documents_count
|
|
* @property-read mixed $hashed_id
|
|
* @property-read Project|null $project
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
|
|
* @property-read int|null $tasks_count
|
|
* @property-read \App\Models\User $user
|
|
* @property-read \App\Models\Vendor|null $vendor
|
|
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel company()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel exclude($columns)
|
|
* @method static \Database\Factories\ProjectFactory factory($count = null, $state = [])
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project filter(\App\Filters\QueryFilters $filters)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project onlyTrashed()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel scope()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereAssignedUserId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereBudgetedHours($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereClientId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereColor($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereCompanyId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereCustomValue1($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereCustomValue2($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereCustomValue3($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereCustomValue4($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereDeletedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereDueDate($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereIsDeleted($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereName($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereNumber($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project wherePrivateNotes($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project wherePublicNotes($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereTaskRate($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereUpdatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereUserId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project withTrashed()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project withoutTrashed()
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
|
|
* @property int|null $current_hours
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Project whereCurrentHours($value)
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
|
|
* @mixin \Eloquent
|
|
*/
|
|
class Project extends BaseModel
|
|
{
|
|
use SoftDeletes;
|
|
use PresentableTrait;
|
|
use Filterable;
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
/**
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'name',
|
|
'client_id',
|
|
'task_rate',
|
|
'private_notes',
|
|
'public_notes',
|
|
'due_date',
|
|
'budgeted_hours',
|
|
'custom_value1',
|
|
'custom_value2',
|
|
'custom_value3',
|
|
'custom_value4',
|
|
'assigned_user_id',
|
|
'color',
|
|
'number',
|
|
];
|
|
|
|
public function getEntityType()
|
|
{
|
|
return self::class;
|
|
}
|
|
|
|
protected $touches = [];
|
|
|
|
/**
|
|
* @return BelongsTo
|
|
*/
|
|
public function company()
|
|
{
|
|
return $this->belongsTo(Company::class);
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function client()
|
|
{
|
|
return $this->belongsTo(Client::class)->withTrashed();
|
|
}
|
|
|
|
public function vendor()
|
|
{
|
|
return $this->belongsTo(Vendor::class)->withTrashed();
|
|
}
|
|
|
|
public function project()
|
|
{
|
|
return $this->belongsTo(self::class)->withTrashed();
|
|
}
|
|
|
|
public function documents()
|
|
{
|
|
return $this->morphMany(Document::class, 'documentable');
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class)->withTrashed();
|
|
}
|
|
|
|
public function tasks()
|
|
{
|
|
return $this->hasMany(Task::class);
|
|
}
|
|
|
|
public function translate_entity()
|
|
{
|
|
return ctrans('texts.project');
|
|
}
|
|
}
|