1 | <?php |
||
8 | trait Applicant |
||
9 | { |
||
10 | /** |
||
11 | * creates a new application model object for this model. |
||
12 | * |
||
13 | * @param null|array|object $model |
||
14 | * @param array $criteria |
||
15 | * @return \Te7aHoudini\LaravelApplicant\Models\Application |
||
16 | */ |
||
17 | public function appliesFor($model = null, $criteria = []) |
||
51 | |||
52 | /** |
||
53 | * check if current model has applied on application or not. |
||
54 | * |
||
55 | * @param null|array|object $model |
||
56 | * @param array $criteria |
||
57 | * @return bool |
||
58 | */ |
||
59 | public function hasAppliedFor($model = null, $criteria = []) |
||
63 | |||
64 | /** |
||
65 | * get applications that model has applied on. |
||
66 | * |
||
67 | * @param null|array|object $model |
||
68 | * @param array $criteria |
||
69 | * @return \Illuminate\Database\Eloquent\Builder |
||
70 | */ |
||
71 | public function appliedApplicationsFor($model = null, $criteria = []) |
||
103 | |||
104 | /** |
||
105 | * sets applicantCriteria attribute and returns $this to allow fluent api. |
||
106 | * |
||
107 | * @param array $criteria |
||
108 | * @return self |
||
109 | */ |
||
110 | public function setApplicantCriteria($criteria = []) |
||
116 | |||
117 | /** |
||
118 | * returns this model applied applications. |
||
119 | * |
||
120 | * @return \Illuminate\Database\Eloquent\Relations\MorphMany |
||
121 | */ |
||
122 | public function appliedApplications() |
||
126 | } |
||
127 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: