2016-10-15 10:03:56 +02:00
|
|
|
<?php
|
|
|
|
use Respect\Validation\Validator as DataValidator;
|
|
|
|
|
2016-10-18 04:19:04 +02:00
|
|
|
class GetNewTicketsStaffController extends Controller {
|
2016-10-15 10:03:56 +02:00
|
|
|
const PATH = '/get-new-tickets';
|
|
|
|
|
|
|
|
public function validations() {
|
|
|
|
return[
|
|
|
|
'permission' => 'staff_1',
|
|
|
|
'requestData' => []
|
|
|
|
];
|
|
|
|
}
|
|
|
|
public function handler() {
|
2016-10-18 04:19:04 +02:00
|
|
|
$user = Controller::getLoggedUser();
|
|
|
|
$query = ' (';
|
|
|
|
foreach ($user->sharedDepartmentList as $department) {
|
|
|
|
$query .= 'department_id=' . $department->id . ' OR ';
|
|
|
|
}
|
|
|
|
$query = substr($query,0,-3);
|
|
|
|
$query .= ') AND owner_id IS NULL';
|
|
|
|
|
|
|
|
$ticketList = Ticket::find($query);
|
|
|
|
|
|
|
|
Response::respondSuccess($ticketList->toArray());
|
2016-10-15 10:03:56 +02:00
|
|
|
}
|
|
|
|
}
|