scriptotek /
bibrex
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Notifications; |
||
| 4 | |||
| 5 | use App\Loan; |
||
| 6 | use Illuminate\Notifications\DatabaseNotification; |
||
| 7 | |||
| 8 | class ExtendedDatabaseNotification extends DatabaseNotification |
||
| 9 | { |
||
| 10 | public function loan() |
||
| 11 | { |
||
| 12 | return $this->belongsTo(Loan::class) |
||
| 13 | ->withTrashed(); |
||
| 14 | } |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The accessors to append to the model's array form. |
||
| 18 | * |
||
| 19 | * @var array |
||
| 20 | */ |
||
| 21 | protected $appends = ['url']; |
||
| 22 | |||
| 23 | public function getUrlAttribute() |
||
| 24 | { |
||
| 25 | return action('NotificationsController@show', $this->id); |
||
| 26 | } |
||
| 27 | |||
| 28 | public function humanReadableType() |
||
| 29 | { |
||
| 30 | switch ($this->type) { |
||
|
0 ignored issues
–
show
|
|||
| 31 | case ManualReminder::class: |
||
| 32 | return 'Manuell påminnelse'; |
||
| 33 | case FirstReminder::class: |
||
| 34 | return 'Automatisk påminnelse'; |
||
| 35 | default: |
||
| 36 | return 'Påminnelse'; |
||
| 37 | } |
||
| 38 | } |
||
| 39 | } |
||
| 40 |
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.