Guillermo - staff-un-assign-ticket[skip ci]

This commit is contained in:
AntonyAntonio 2016-10-17 23:19:04 -03:00
parent 73633278e6
commit d9124eb21a
2 changed files with 17 additions and 3 deletions

View File

@ -1,7 +1,7 @@
<?php
use Respect\Validation\Validator as DataValidator;
class GetNewTicketsStaffControllers extends Controller {
class GetNewTicketsStaffController extends Controller {
const PATH = '/get-new-tickets';
public function validations() {
@ -10,8 +10,17 @@ class GetNewTicketsStaffControllers extends Controller {
'requestData' => []
];
}
public function handler() {
$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());
}
}

View File

@ -30,6 +30,11 @@ abstract class DataStore {
return $dataStoreList;
}
public static function find($query) {
$beanList = RedBean::find(static::TABLE,$query);
return DataStoreList::getList(ucfirst(static::TABLE),$beanList);
}
private static function validateProp($propToValidate) {
$validProp = false;