Merge branch 'develop' into trunk
This commit is contained in:
commit
8049e45f42
1 changed files with 8 additions and 5 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\Role;
|
||||
use App\Enums\TicketStatus;
|
||||
use App\Enums\TicketType;
|
||||
use App\Events\NotifySubscriptions;
|
||||
|
|
@ -38,12 +39,14 @@ class TicketController extends Controller
|
|||
{
|
||||
/** @var \App\Models\User */
|
||||
$user = auth()->user();
|
||||
$tickets = Ticket::with('project')
|
||||
->whereHas('project', function ($q) use ($user) {
|
||||
$q->whereHas('users', function ($q) use ($user) {
|
||||
$q->whereId($user->id);
|
||||
$tickets = Ticket::with('project');
|
||||
if (!$user->role->equals(Role::admin())) {
|
||||
$tickets = $tickets->whereHas('project', function ($q) use ($user) {
|
||||
$q->whereHas('users', function ($q) use ($user) {
|
||||
$q->whereId($user->id);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
$tickets = $tickets->where('status', $request->status ? '=' : '<>', TicketStatus::archived());
|
||||
if ($request->search) {
|
||||
$tickets = $this->searchTicket($tickets, $request);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue