Skip to content

Commit

Permalink
Added: restricted action to user
Browse files Browse the repository at this point in the history
  • Loading branch information
we-vikram-wri231 committed Jun 22, 2024
1 parent 47f3d2e commit 6360572
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
21 changes: 4 additions & 17 deletions skeletons/vaahcms/module-vue3/Vue/vaahvue/pinia/vaah.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,25 +120,12 @@ export const vaah = defineStore({

//----------------------------------------------------------
processResponse: function (response, show_success) {
if (
response.data.failed || response.data.success === false
) {

if (response.data.messages) {
this.toastErrors(response.data.messages)
}

if (response.data.errors) {
this.toastErrors(response.data.errors)
}

if (response.data.errors) {
this.toastErrors(response.data.errors)
}

if (
response.data.success
&& response.data.success === true
&& response.data.messages
&& show_success === true
if (response.data.messages
&& show_success === true
) {
this.toastSuccess(response.data.messages)
}
Expand Down
10 changes: 10 additions & 0 deletions skeletons/vaahcms/users/Http/Controllers/Controller.php.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@ class <%= controller_name %>Controller extends Controller
{

try {

$is_restricted = <%= model_name %>::restrictedActions($action, $id);

if(isset($is_restricted['success']) && !$is_restricted['success'])
{
$response = <%= model_name %>::getItem($id);
$response['errors'] = $is_restricted['errors'];
return response()->json($response);
}

$response = <%= model_name %>::itemAction($request,$id,$action);
} catch (\Exception $e) {
$response = [];
Expand Down

0 comments on commit 6360572

Please sign in to comment.