Skip to content

Updated route group as admin #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/Http/Controllers/Admin/CategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function store(StoreCategoryRequest $request, CategoryType $type)

$type->categories()->create($request->all());

return redirect()->route('category.type.item.index', $type->id)
return redirect()->route('admin.category.type.item.index', $type->id)
->with('message', 'Category created successfully.');
}

Expand Down Expand Up @@ -101,7 +101,7 @@ public function update(UpdateCategoryRequest $request, CategoryType $type, Categ

$item->update($request->all());

return redirect()->route('category.type.item.index', $type->id)
return redirect()->route('admin.category.type.item.index', $type->id)
->with('message', 'Category updated successfully.');
}

Expand All @@ -115,7 +115,7 @@ public function destroy(CategoryType $type, Category $item)
{
$item->delete();

return redirect()->route('category.type.item.index', $type->id)
return redirect()->route('admin.category.type.item.index', $type->id)
->with('message', __('Category deleted successfully'));
}
}
6 changes: 3 additions & 3 deletions app/Http/Controllers/Admin/CategoryTypeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function store(StoreCategoryTypeRequest $request)
'is_flat' => $request->is_flat,
]);

return redirect()->route('category.type.index')
return redirect()->route('admin.category.type.index')
->with('message', 'Category type created successfully.');
}

Expand Down Expand Up @@ -117,7 +117,7 @@ public function update(UpdateCategoryTypeRequest $request, CategoryType $type)

$type->update($request->all());

return redirect()->route('category.type.index')
return redirect()->route('admin.category.type.index')
->with('message', 'Category type updated successfully.');
}

Expand All @@ -131,7 +131,7 @@ public function destroy(CategoryType $type)
{
$type->delete();

return redirect()->route('category.type.index')
return redirect()->route('admin.category.type.index')
->with('message', __('Category type deleted successfully'));
}
}
6 changes: 3 additions & 3 deletions app/Http/Controllers/Admin/MenuController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function store(StoreMenuRequest $request)
'description' => $request->description,
]);

return redirect()->route('menu.index')
return redirect()->route('admin.menu.index')
->with('message', 'Menu created successfully.');
}

Expand All @@ -106,7 +106,7 @@ public function update(UpdateMenuRequest $request, Menu $menu)
{
$menu->update($request->all());

return redirect()->route('menu.index')
return redirect()->route('admin.menu.index')
->with('message', 'Menu updated successfully.');
}

Expand All @@ -119,7 +119,7 @@ public function destroy(Menu $menu)
{
$menu->delete();

return redirect()->route('menu.index')
return redirect()->route('admin.menu.index')
->with('message', __('Menu deleted successfully'));
}
}
6 changes: 3 additions & 3 deletions app/Http/Controllers/Admin/MenuItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function store(StoreMenuItemRequest $request, Menu $menu)
{
$menu->menuItems()->create($request->all());

return redirect()->route('menu.item.index', $menu->id)
return redirect()->route('admin.menu.item.index', $menu->id)
->with('message', 'Menu created successfully.');
}

Expand Down Expand Up @@ -93,7 +93,7 @@ public function update(UpdateMenuItemRequest $request, Menu $menu, MenuItem $ite
{
$item->update($request->all());

return redirect()->route('menu.item.index', $menu->id)
return redirect()->route('admin.menu.item.index', $menu->id)
->with('message', 'Menu Item updated successfully.');
}

Expand All @@ -107,7 +107,7 @@ public function destroy(Menu $menu, MenuItem $item)
{
$item->delete();

return redirect()->route('menu.item.index', $menu->id)
return redirect()->route('admin.menu.item.index', $menu->id)
->with('message', __('Menu deleted successfully'));
}
}
6 changes: 3 additions & 3 deletions app/Http/Controllers/Admin/PermissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function store(StorePermissionRequest $request)
{
Permission::create($request->all());

return redirect()->route('permission.index')
return redirect()->route('admin.permission.index')
->with('message', __('Permission created successfully.'));
}

Expand Down Expand Up @@ -113,7 +113,7 @@ public function update(UpdatePermissionRequest $request, Permission $permission)
{
$permission->update($request->all());

return redirect()->route('permission.index')
return redirect()->route('admin.permission.index')
->with('message', __('Permission updated successfully.'));
}

Expand All @@ -126,7 +126,7 @@ public function destroy(Permission $permission)
{
$permission->delete();

return redirect()->route('permission.index')
return redirect()->route('admin.permission.index')
->with('message', __('Permission deleted successfully'));
}
}
6 changes: 3 additions & 3 deletions app/Http/Controllers/Admin/RoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function store(StoreRoleRequest $request)
$role->givePermissionTo($request->permissions);
}

return redirect()->route('role.index')
return redirect()->route('admin.role.index')
->with('message', 'Role created successfully.');
}

Expand Down Expand Up @@ -134,7 +134,7 @@ public function update(UpdateRoleRequest $request, Role $role)
$permissions = $request->permissions ?? [];
$role->syncPermissions($permissions);

return redirect()->route('role.index')
return redirect()->route('admin.role.index')
->with('message', 'Role updated successfully.');
}

Expand All @@ -147,7 +147,7 @@ public function destroy(Role $role)
{
$role->delete();

return redirect()->route('role.index')
return redirect()->route('admin.role.index')
->with('message', __('Role deleted successfully'));
}
}
8 changes: 4 additions & 4 deletions app/Http/Controllers/Admin/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ public function create()
/**
* Store a newly created resource in storage.
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\RedirectResponse
*/
public function store(StoreUserRequest $request, CreateUser $createUser)
{
$createUser->handle((object) $request->all());

return redirect()->route('user.index')
return redirect()->route('admin.user.index')
->with('message', __('User created successfully.'));
}

Expand Down Expand Up @@ -133,7 +133,7 @@ public function update(UpdateUserRequest $request, User $user, UpdateUser $updat
{
$updateUser->handle((object) $request->all(), $user);

return redirect()->route('user.index')
return redirect()->route('admin.user.index')
->with('message', __('User updated successfully.'));
}

Expand All @@ -146,7 +146,7 @@ public function destroy(User $user)
{
$user->delete();

return redirect()->route('user.index')
return redirect()->route('admin.user.index')
->with('message', __('User deleted successfully'));
}

Expand Down
2 changes: 1 addition & 1 deletion resources/js/Components/Admin/CategoryItemList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const props = defineProps({
<BaseButtons type="justify-start lg:justify-end" no-wrap>
<BaseButton
v-if="can.edit"
:route-name="route('category.type.item.edit', {type: categoryType.id, item: item.id})"
:route-name="route('admin.category.type.item.edit', {type: categoryType.id, item: item.id})"
color="info"
:icon="mdiSquareEditOutline"
small
Expand Down
2 changes: 1 addition & 1 deletion resources/js/Components/Admin/MenuItemList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const props = defineProps({
<BaseButtons type="justify-start lg:justify-end" no-wrap>
<BaseButton
v-if="can.edit"
:route-name="route('menu.item.edit', {menu: menu.id, item: item.id})"
:route-name="route('admin.menu.item.edit', {menu: menu.id, item: item.id})"
color="info"
:icon="mdiSquareEditOutline"
small
Expand Down
6 changes: 3 additions & 3 deletions resources/js/Layouts/Authenticated.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ const showingNavigationDropdown = ref(false);
<div class="flex">
<!-- Logo -->
<div class="shrink-0 flex items-center">
<Link :href="route('dashboard')">
<Link :href="route('admin.dashboard')">
<BreezeApplicationLogo class="block h-9 w-auto" />
</Link>
</div>

<!-- Navigation Links -->
<div class="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex">
<BreezeNavLink :href="route('dashboard')" :active="route().current('dashboard')">
<BreezeNavLink :href="route('admin.dashboard')" :active="route().current('admin.dashboard')">
Dashboard
</BreezeNavLink>
<BreezeNavLink :href="route('permission.index')" :active="route().current('permission.index')">
<BreezeNavLink :href="route('admin.permission.index')" :active="route().current('admin.permission.index')">
Permissions
</BreezeNavLink>
</div>
Expand Down
4 changes: 2 additions & 2 deletions resources/js/Pages/Admin/Category/Item/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const form = useForm({
main
>
<BaseButton
:route-name="route('category.type.item.index', categoryType.id)"
:route-name="route('admin.category.type.item.index', categoryType.id)"
:icon="mdiArrowLeftBoldOutline"
label="Back"
color="white"
Expand All @@ -55,7 +55,7 @@ const form = useForm({
</SectionTitleLineWithButton>
<CardBox
form
@submit.prevent="form.post(route('category.type.item.store', categoryType.id))"
@submit.prevent="form.post(route('admin.category.type.item.store', categoryType.id))"
>
<FormField
label="Name"
Expand Down
4 changes: 2 additions & 2 deletions resources/js/Pages/Admin/Category/Item/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const form = useForm({
main
>
<BaseButton
:route-name="route('category.type.item.index', categoryType.id)"
:route-name="route('admin.category.type.item.index', categoryType.id)"
:icon="mdiArrowLeftBoldOutline"
label="Back"
color="white"
Expand All @@ -60,7 +60,7 @@ const form = useForm({
</SectionTitleLineWithButton>
<CardBox
form
@submit.prevent="form.post(route('category.type.item.update', {type: props.categoryType.id, item:props.item.id}))"
@submit.prevent="form.post(route('admin.category.type.item.update', {type: props.categoryType.id, item:props.item.id}))"
>
<FormField
label="Name"
Expand Down
6 changes: 3 additions & 3 deletions resources/js/Pages/Admin/Category/Item/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const formDelete = useForm({})

function destroy(id) {
if (confirm("Are you sure you want to delete?")) {
formDelete.delete(route("category.type.item.destroy", {type: props.categoryType.id, item: id}))
formDelete.delete(route("admin.category.type.item.destroy", {type: props.categoryType.id, item: id}))
}
}

Expand All @@ -51,7 +51,7 @@ function destroy(id) {
>
<BaseButtons type="justify-start lg:justify-end" no-wrap>
<BaseButton
:route-name="route('category.type.index')"
:route-name="route('admin.category.type.index')"
:icon="mdiArrowLeftBoldOutline"
label="Back"
color="white"
Expand All @@ -60,7 +60,7 @@ function destroy(id) {
/>
<BaseButton
v-if="can.delete"
:route-name="route('category.type.item.create', categoryType.id)"
:route-name="route('admin.category.type.item.create', categoryType.id)"
:icon="mdiPlus"
label="Add"
color="info"
Expand Down
4 changes: 2 additions & 2 deletions resources/js/Pages/Admin/Category/Type/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const form = useForm({
main
>
<BaseButton
:route-name="route('category.type.index')"
:route-name="route('admin.category.type.index')"
:icon="mdiArrowLeftBoldOutline"
label="Back"
color="white"
Expand All @@ -41,7 +41,7 @@ const form = useForm({
</SectionTitleLineWithButton>
<CardBox
form
@submit.prevent="form.post(route('category.type.store'))"
@submit.prevent="form.post(route('admin.category.type.store'))"
>
<FormField
label="Name"
Expand Down
4 changes: 2 additions & 2 deletions resources/js/Pages/Admin/Category/Type/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const form = useForm({
main
>
<BaseButton
:route-name="route('category.type.index')"
:route-name="route('admin.category.type.index')"
:icon="mdiArrowLeftBoldOutline"
label="Back"
color="white"
Expand All @@ -47,7 +47,7 @@ const form = useForm({
</SectionTitleLineWithButton>
<CardBox
form
@submit.prevent="form.post(route('category.type.update', props.categoryType.id))"
@submit.prevent="form.post(route('admin.category.type.update', props.categoryType.id))"
>
<FormField
label="Name"
Expand Down
10 changes: 5 additions & 5 deletions resources/js/Pages/Admin/Category/Type/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const formDelete = useForm({})

function destroy(id) {
if (confirm("Are you sure you want to delete?")) {
formDelete.delete(route("category.type.destroy", id))
formDelete.delete(route("admin.category.type.destroy", id))
}
}
</script>
Expand All @@ -57,7 +57,7 @@ function destroy(id) {
>
<BaseButton
v-if="can.delete"
:route-name="route('category.type.create')"
:route-name="route('admin.category.type.create')"
:icon="mdiPlus"
label="Add"
color="info"
Expand All @@ -74,7 +74,7 @@ function destroy(id) {
{{ $page.props.flash.message }}
</NotificationBar>
<CardBox class="mb-6" has-table>
<form @submit.prevent="form.get(route('category.type.index'))">
<form @submit.prevent="form.get(route('admin.category.type.index'))">
<div class="py-2 flex">
<div class="flex pl-4">
<input
Expand Down Expand Up @@ -130,14 +130,14 @@ function destroy(id) {
<BaseButtons type="justify-start lg:justify-end" no-wrap>
<BaseButton
v-if="can.manage"
:route-name="route('category.type.item.index', categoryType.id)"
:route-name="route('admin.category.type.item.index', categoryType.id)"
color="warning"
:icon="mdiCogOutline "
small
/>
<BaseButton
v-if="can.edit"
:route-name="route('category.type.edit', categoryType.id)"
:route-name="route('admin.category.type.edit', categoryType.id)"
color="info"
:icon="mdiSquareEditOutline"
small
Expand Down
4 changes: 2 additions & 2 deletions resources/js/Pages/Admin/Menu/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const form = useForm({
main
>
<BaseButton
:route-name="route('menu.index')"
:route-name="route('admin.menu.index')"
:icon="mdiArrowLeftBoldOutline"
label="Back"
color="white"
Expand All @@ -47,7 +47,7 @@ const form = useForm({
</SectionTitleLineWithButton>
<CardBox
form
@submit.prevent="form.post(route('menu.update', props.menu.id))"
@submit.prevent="form.post(route('admin.menu.update', props.menu.id))"
>
<FormField
label="Name"
Expand Down
Loading