Merge branch 'master' of github.com:akaunting/akaunting
This commit is contained in:
commit
fa266cb3f2
@ -30,7 +30,7 @@ abstract class Controller extends BaseController
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function setPermissions()
|
public function setPermissions()
|
||||||
{
|
{
|
||||||
// No need to check for permission in console
|
// No need to check for permission in console
|
||||||
if (app()->runningInConsole()) {
|
if (app()->runningInConsole()) {
|
||||||
@ -90,33 +90,4 @@ abstract class Controller extends BaseController
|
|||||||
|
|
||||||
return new LengthAwarePaginator($items->forPage($page, $perPage), $items->count(), $perPage, $page, $options);
|
return new LengthAwarePaginator($items->forPage($page, $perPage), $items->count(), $perPage, $page, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Dispatch a job to its appropriate handler and return a response array for ajax calls.
|
|
||||||
*
|
|
||||||
* @param mixed $job
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function ajaxDispatch($job)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$data = $this->dispatch($job);
|
|
||||||
|
|
||||||
$response = [
|
|
||||||
'success' => true,
|
|
||||||
'error' => false,
|
|
||||||
'data' => $data,
|
|
||||||
'message' => '',
|
|
||||||
];
|
|
||||||
} catch(\Exception $e) {
|
|
||||||
$response = [
|
|
||||||
'success' => false,
|
|
||||||
'error' => true,
|
|
||||||
'data' => null,
|
|
||||||
'message' => $e->getMessage(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,35 @@ trait Jobs
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch a job to its appropriate handler and return a response array for ajax calls.
|
||||||
|
*
|
||||||
|
* @param mixed $job
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function ajaxDispatch($job)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$data = $this->dispatch($job);
|
||||||
|
|
||||||
|
$response = [
|
||||||
|
'success' => true,
|
||||||
|
'error' => false,
|
||||||
|
'data' => $data,
|
||||||
|
'message' => '',
|
||||||
|
];
|
||||||
|
} catch(\Exception $e) {
|
||||||
|
$response = [
|
||||||
|
'success' => false,
|
||||||
|
'error' => true,
|
||||||
|
'data' => null,
|
||||||
|
'message' => $e->getMessage(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
public function getDispatchFunction()
|
public function getDispatchFunction()
|
||||||
{
|
{
|
||||||
$config = config('queue.default');
|
$config = config('queue.default');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user