1 | <?php |
||
34 | class Owner extends Model |
||
35 | { |
||
36 | use ValidatingTrait; |
||
37 | |||
38 | /** |
||
39 | * The attributes that should be casted to native types. |
||
40 | * |
||
41 | * @var string[] |
||
42 | */ |
||
43 | protected $casts = [ |
||
44 | 'id' => 'int', |
||
45 | 'name' => 'string', |
||
46 | 'path' => 'string', |
||
47 | 'user_id' => 'int', |
||
48 | 'type' => 'string', |
||
49 | ]; |
||
50 | |||
51 | /** |
||
52 | * The fillable properties. |
||
53 | * |
||
54 | * @var string[] |
||
55 | */ |
||
56 | protected $fillable = [ |
||
57 | 'name', |
||
58 | 'path', |
||
59 | 'user_id', |
||
60 | 'description', |
||
61 | 'type', |
||
62 | ]; |
||
63 | |||
64 | /** |
||
65 | * The validation rules. |
||
66 | * |
||
67 | * @var string[] |
||
68 | */ |
||
69 | public $rules = [ |
||
70 | 'name' => 'required|string', |
||
71 | 'path' => 'required|string|max:15', |
||
72 | 'user_id' => 'int', |
||
73 | 'type' => 'string', |
||
74 | 'description' => 'string', |
||
75 | ]; |
||
76 | |||
77 | /** |
||
78 | * A owner can have many projects. |
||
79 | * |
||
80 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
81 | */ |
||
82 | public function projects() |
||
86 | |||
87 | /** |
||
88 | * Find by path, or throw an exception. |
||
89 | * |
||
90 | * @param string $path |
||
91 | * @param string[] $columns |
||
92 | * |
||
93 | * @throws \Illuminate\Database\Eloquent\ModelNotFoundException |
||
94 | * |
||
95 | * @return \Gitamin\Models\User |
||
96 | */ |
||
97 | public static function findByPath($path, $columns = ['*']) |
||
107 | |||
108 | /** |
||
109 | * Finds all my owners. |
||
110 | * |
||
111 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
112 | * |
||
113 | * @return \Illuminate\Database\Eloquent\Builder |
||
114 | */ |
||
115 | public function scopeMine($query) |
||
119 | } |
||
120 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.