-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Temuulen Bayanmunkh
authored and
Temuulen Bayanmunkh
committed
Oct 20, 2023
1 parent
eb9773b
commit 56daee0
Showing
5 changed files
with
54 additions
and
15 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/Http/Controllers/Internal/v1/NotificationController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Fleetbase\Http\Controllers\Internal\v1; | ||
|
||
use Fleetbase\Http\Controllers\FleetbaseController; | ||
|
||
class NotificationController extends FleetbaseController | ||
{ | ||
/** | ||
* The resource to query. | ||
* | ||
* @var string | ||
*/ | ||
public $resource = 'notification'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Fleetbase\Http\Filter; | ||
|
||
class NotificationFilter extends Filter | ||
{ | ||
public function queryForInternal() | ||
{ | ||
$this->builder->where(function ($q) { | ||
$q->where('notifiable_id', $this->session->get('company')); | ||
$q->orWhere('notifiable_id', $this->session->get('user')); | ||
}); | ||
} | ||
|
||
public function query(?string $query) | ||
{ | ||
$this->builder->search($query); | ||
} | ||
|
||
public function unread(?bool $unread) | ||
{ | ||
if ($unread) { | ||
$this->builder->whereNull('read_at'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters