-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathProject.php
49 lines (41 loc) · 1008 Bytes
/
Project.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Modules\HR\Entities\Employee;
class Project extends Model
{
protected $guarded = [];
protected $table = 'projects_old';
/**
* Get the client that owns the project.
*/
public function client()
{
return $this->belongsTo(Client::class);
}
/**
* Get details to list projects.
*/
public static function getList()
{
return self::with(['client' => function ($query) {
$query->select('id', 'name');
}])
->orderBy('id', 'desc')
->paginate(config('constants.pagination_size'));
}
/**
* Get the stages for the project.
*/
public function stages()
{
return $this->hasMany(ProjectStage::class);
}
/**
* Get the employees for the project.
*/
public function employees()
{
return $this->belongsToMany(Employee::class)->withPivot('contribution_type');
}
}