Last change
on this file was d25ba66, checked in by Özkan İliyaz <iliyaz_96@…>, 4 years ago |
ADD post confirmation with multiple phases, notification after succesfully password creation
|
-
Property mode
set to
100644
|
File size:
706 bytes
|
Rev | Line | |
---|
[d25ba66] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | namespace App\Models;
|
---|
| 4 |
|
---|
| 5 | use Illuminate\Database\Eloquent\Model;
|
---|
| 6 |
|
---|
| 7 | class Review extends Model
|
---|
| 8 | {
|
---|
| 9 | protected $table = "post_reviews";
|
---|
| 10 |
|
---|
| 11 | public function post()
|
---|
| 12 | {
|
---|
| 13 | return $this->belongsTo(Post::class);
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | public function postSecurity()
|
---|
| 17 | {
|
---|
| 18 | return $this->belongsTo(PostSecurity::class, "post_security_id");
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | public function getPhase()
|
---|
| 22 | {
|
---|
| 23 | return $this->postSecurity->phases()->where("id", $this->current_phase)->first();
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | public function canReview()
|
---|
| 27 | {
|
---|
| 28 | return $this->getPhase()->reviewer_role_id == auth()->user()->role->id;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | public function getCurrentReviewer()
|
---|
| 32 | {
|
---|
| 33 | return $this->getPhase()->reviewer;
|
---|
| 34 | }
|
---|
| 35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.