Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
Bug fix ApiController
Browse files Browse the repository at this point in the history
  • Loading branch information
fherryfherry committed Dec 28, 2017
1 parent e1ea24f commit 97de135
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/controllers/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function execute_api() {
if ( ! Request::isMethod( $method_type ) ) {
$result['api_status'] = 0;
$result['api_message'] = "The requested method is not allowed!";
$result['api_http'] = 200;
$result['api_http'] = 401;
goto show;
}
}
Expand Down Expand Up @@ -175,7 +175,7 @@ public function execute_api() {
$message = implode( ', ', $message );
$result['api_status'] = 0;
$result['api_message'] = $message;
$result['api_http'] = 200;
$result['api_http'] = 401;
goto show;
}
}
Expand Down
13 changes: 13 additions & 0 deletions src/helpers/CRUDBooster.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ public static function isLocked() {
return Session::get('admin_lock');
}

public static function redirectBack($message,$type='warning') {

if(Request::ajax()) {
$resp = response()->json(['message'=>$message,'message_type'=>$type,'redirect_url'=>$_SERVER['HTTP_REFERER']])->send();
exit;
}else{
$resp = redirect()->back()->with(['message'=>$message,'message_type'=>$type]);
Session::driver()->save();
$resp->send();
exit;
}
}

public static function redirect($to,$message,$type='warning') {

if(Request::ajax()) {
Expand Down

0 comments on commit 97de135

Please sign in to comment.