1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of Gitamin. |
5
|
|
|
* |
6
|
|
|
* Copyright (C) 2015-2016 The Gitamin Team |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
# == Schema Information |
13
|
|
|
# |
14
|
|
|
# Table name: members |
15
|
|
|
# |
16
|
|
|
# id :integer not null, primary key |
17
|
|
|
# access_level :integer not null |
18
|
|
|
# source_id :integer not null |
19
|
|
|
# source_type :string(255) not null |
20
|
|
|
# user_id :integer |
21
|
|
|
# notification_level :integer not null |
22
|
|
|
# type :string(255) |
23
|
|
|
# created_at :datetime |
24
|
|
|
# updated_at :datetime |
25
|
|
|
# created_by_id :integer |
26
|
|
|
# invite_email :string(255) |
27
|
|
|
# invite_token :string(255) |
28
|
|
|
# invite_accepted_at :datetime |
29
|
|
|
# |
30
|
|
|
|
31
|
|
|
namespace Gitamin\Models; |
32
|
|
|
|
33
|
|
|
use AltThree\Validator\ValidatingTrait; |
34
|
|
|
use Gitamin\Presenters\IssuePresenter; |
35
|
|
|
use Illuminate\Database\Eloquent\Model; |
36
|
|
|
use McCool\LaravelAutoPresenter\HasPresenter; |
37
|
|
|
|
38
|
|
|
class Member extends Model implements HasPresenter |
39
|
|
|
{ |
40
|
|
|
use ValidatingTrait; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* The attributes that should be casted to native types. |
44
|
|
|
* |
45
|
|
|
* @var string[] |
46
|
|
|
*/ |
47
|
|
|
protected $casts = [ |
48
|
|
|
'access_level' => 'int', |
49
|
|
|
'source_id' => 'int', |
50
|
|
|
'source_type' => 'string', |
51
|
|
|
'user_id' => 'int', |
52
|
|
|
'notification_level' => 'int', |
53
|
|
|
'type' => 'string', |
54
|
|
|
'created_by_id' => 'int', |
55
|
|
|
]; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* The fillable properties. |
59
|
|
|
* |
60
|
|
|
* @var string[] |
61
|
|
|
*/ |
62
|
|
|
protected $fillable = [ |
63
|
|
|
'access_level', |
64
|
|
|
'source_id', |
65
|
|
|
'source_type', |
66
|
|
|
'notification_level', |
67
|
|
|
'type', |
68
|
|
|
]; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* The validation rules. |
72
|
|
|
* |
73
|
|
|
* @var string[] |
74
|
|
|
*/ |
75
|
|
|
public $rules = [ |
76
|
|
|
'source_id' => 'required|string', |
77
|
|
|
'source_type' => 'required|string', |
78
|
|
|
'user_id' => 'int', |
79
|
|
|
'type' => 'string', |
80
|
|
|
'created_by_id' => 'int', |
81
|
|
|
]; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Get the presenter class. |
85
|
|
|
* |
86
|
|
|
* @return string |
87
|
|
|
*/ |
88
|
|
|
public function getPresenterClass() |
89
|
|
|
{ |
90
|
|
|
return IssuePresenter::class; |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
|