Skip to content

Commit

Permalink
Fixed code formatting using Laravel pint
Browse files Browse the repository at this point in the history
  • Loading branch information
balajidharma committed Jan 14, 2024
1 parent ab1fc97 commit 15b3484
Show file tree
Hide file tree
Showing 22 changed files with 75 additions and 203 deletions.
1 change: 0 additions & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class Kernel extends ConsoleKernel
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
Expand Down
33 changes: 14 additions & 19 deletions app/Http/Controllers/Admin/CategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use App\Http\Controllers\Controller;
use BalajiDharma\LaravelAdminCore\Requests\StoreCategoryRequest;
use BalajiDharma\LaravelAdminCore\Requests\UpdateCategoryRequest;
use BalajiDharma\LaravelCategory\Models\CategoryType;
use BalajiDharma\LaravelCategory\Models\Category;
use BalajiDharma\LaravelCategory\Models\CategoryType;
use Illuminate\Support\Facades\Auth;
use Inertia\Inertia;

Expand Down Expand Up @@ -36,91 +36,86 @@ public function index(CategoryType $type)
'create' => Auth::user()->can('category create'),
'edit' => Auth::user()->can('category edit'),
'delete' => Auth::user()->can('category delete'),
]
],
]);
}

/**
/**
* Show the form for creating a new resource.
*
* @return \Inertia\Response
*/
public function create(CategoryType $type)
{
$itemOptions = Category::selectOptions($type->id, null, true);

return Inertia::render('Admin/Category/Item/Create', [
'categoryType' => $type,
'itemOptions' => $itemOptions
'itemOptions' => $itemOptions,
]);
}

/**
* Store a newly created resource in storage.
*
* @param StoreCategoryRequest $request
* @param \BalajiDharma\LaravelCategory\Models\CategoryType $type
* @return \Illuminate\Http\RedirectResponse
*/
public function store(StoreCategoryRequest $request, CategoryType $type)
{
if(!$request->has('enabled')) {
if (! $request->has('enabled')) {
$request['enabled'] = false;
}

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

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

/**
* Show the form for editing the specified resource.
*
* @param \BalajiDharma\LaravelCategory\Models\CategoryType $type
* @return \Inertia\Response
*/
public function edit(CategoryType $type, Category $item)
{
$itemOptions = Category::selectOptions($type->id, $item->parent_id ?? $item->id);

return Inertia::render('Admin/Category/Item/Edit', [
'categoryType' => $type,
'item' => $item,
'itemOptions' => $itemOptions
'itemOptions' => $itemOptions,
]);
}

/**
* Update the specified resource in storage.
*
* @param UpdateCategoryRequest $request
* @param \BalajiDharma\LaravelCategory\Models\CategoryType $type
* @param \BalajiDharma\LaravelCategory\Models\Category $item
* @return \Illuminate\Http\RedirectResponse
*/
public function update(UpdateCategoryRequest $request, CategoryType $type, Category $item)
{
if(!$request->has('enabled')) {
if (! $request->has('enabled')) {
$request['enabled'] = false;
}

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

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

/**
* Remove the specified resource from storage.
*
* @param \BalajiDharma\LaravelCategory\Models\CategoryType $type
* @param \BalajiDharma\LaravelCategory\Models\Category $typeItem
* @param \BalajiDharma\LaravelCategory\Models\Category $typeItem
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(CategoryType $type, Category $item)
{
$item->delete();

return redirect()->route('category.type.item.index', $type->id)
->with('message', __('Category deleted successfully'));
->with('message', __('Category deleted successfully'));
}
}
}
16 changes: 7 additions & 9 deletions app/Http/Controllers/Admin/CategoryTypeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use BalajiDharma\LaravelCategory\Models\CategoryType;
use BalajiDharma\LaravelAdminCore\Requests\StoreCategoryTypeRequest;
use BalajiDharma\LaravelAdminCore\Requests\UpdateCategoryTypeRequest;
use BalajiDharma\LaravelCategory\Models\CategoryType;
use Illuminate\Support\Facades\Auth;
use Inertia\Inertia;

Expand Down Expand Up @@ -54,7 +54,7 @@ public function index()
'edit' => Auth::user()->can('category.type edit'),
'delete' => Auth::user()->can('category.type delete'),
'manage' => Auth::user()->can('category index'),
]
],
]);
}

Expand All @@ -71,12 +71,11 @@ public function create()
/**
* Store a newly created resource in storage.
*
* @param StoreCategoryTypeRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function store(StoreCategoryTypeRequest $request)
{
if(!$request->has('is_flat')) {
if (! $request->has('is_flat')) {
$request['is_flat'] = false;
}

Expand All @@ -88,7 +87,7 @@ public function store(StoreCategoryTypeRequest $request)
]);

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

/**
Expand All @@ -107,20 +106,19 @@ public function edit(CategoryType $type)
/**
* Update the specified resource in storage.
*
* @param UpdateCategoryTypeRequest $request
* @param \BalajiDharma\LaravelCategory\Models\CategoryType $categoryType
* @return \Illuminate\Http\RedirectResponse
*/
public function update(UpdateCategoryTypeRequest $request, CategoryType $type)
{
if(!$request->has('is_flat')) {
if (! $request->has('is_flat')) {
$request['is_flat'] = false;
}

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

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

/**
Expand All @@ -134,6 +132,6 @@ public function destroy(CategoryType $type)
$type->delete();

return redirect()->route('category.type.index')
->with('message', __('Category type deleted successfully'));
->with('message', __('Category type deleted successfully'));
}
}
15 changes: 5 additions & 10 deletions app/Http/Controllers/Admin/MenuController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use BalajiDharma\LaravelMenu\Models\Menu;
use BalajiDharma\LaravelAdminCore\Requests\StoreMenuRequest;
use BalajiDharma\LaravelAdminCore\Requests\UpdateMenuRequest;
use BalajiDharma\LaravelMenu\Models\Menu;
use Illuminate\Support\Facades\Auth;
use Inertia\Inertia;

Expand Down Expand Up @@ -54,7 +54,7 @@ public function index()
'edit' => Auth::user()->can('menu edit'),
'delete' => Auth::user()->can('menu delete'),
'manage' => Auth::user()->can('menu.item index'),
]
],
]);
}

Expand All @@ -71,7 +71,6 @@ public function create()
/**
* Store a newly created resource in storage.
*
* @param StoreMenuRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function store(StoreMenuRequest $request)
Expand All @@ -83,13 +82,12 @@ public function store(StoreMenuRequest $request)
]);

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

/**
* Show the form for editing the specified resource.
*
* @param \BalajiDharma\LaravelMenu\Models\Menu $menu
* @return \Inertia\Response
*/
public function edit(Menu $menu)
Expand All @@ -102,29 +100,26 @@ public function edit(Menu $menu)
/**
* Update the specified resource in storage.
*
* @param UpdateMenuRequest $request
* @param \BalajiDharma\LaravelMenu\Models\Menu $menu
* @return \Illuminate\Http\RedirectResponse
*/
public function update(UpdateMenuRequest $request, Menu $menu)
{
$menu->update($request->all());

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

/**
* Remove the specified resource from storage.
*
* @param \BalajiDharma\LaravelMenu\Models\Menu $menu
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(Menu $menu)
{
$menu->delete();

return redirect()->route('menu.index')
->with('message', __('Menu deleted successfully'));
->with('message', __('Menu deleted successfully'));
}
}
25 changes: 10 additions & 15 deletions app/Http/Controllers/Admin/MenuItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function index(Menu $menu)
'create' => Auth::user()->can('menu.item create'),
'edit' => Auth::user()->can('menu.item edit'),
'delete' => Auth::user()->can('menu.item delete'),
]
],
]);
}

Expand All @@ -48,71 +48,66 @@ public function index(Menu $menu)
public function create(Menu $menu)
{
$item_options = MenuItem::selectOptions($menu->id, null, true);

return Inertia::render('Admin/Menu/Item/Create', [
'menu' => $menu,
'item_options' => $item_options
'item_options' => $item_options,
]);
}

/**
* Store a newly created resource in storage.
*
* @param StoreMenuItemRequest $request
* @param \BalajiDharma\LaravelMenu\Models\Menu $menu
* @return \Illuminate\Http\RedirectResponse
*/
public function store(StoreMenuItemRequest $request, Menu $menu)
{
$menu->menuItems()->create($request->all());

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

/**
* Show the form for editing the specified resource.
*
* @param \BalajiDharma\LaravelMenu\Models\Menu $menu
* @return \Inertia\Response
*/
public function edit(Menu $menu, MenuItem $item)
{
$item_options = MenuItem::selectOptions($menu->id, $item->parent_id ?? $item->id);

return Inertia::render('Admin/Menu/Item/Edit', [
'menu' => $menu,
'item' => $item,
'item_options' => $item_options
'item_options' => $item_options,
]);
}

/**
* Update the specified resource in storage.
*
* @param UpdateMenuItemRequest $request
* @param \BalajiDharma\LaravelMenu\Models\Menu $menu
* @param \BalajiDharma\LaravelMenu\Models\MenuItem $item
* @return \Illuminate\Http\RedirectResponse
*/
public function update(UpdateMenuItemRequest $request, Menu $menu, MenuItem $item)
{
$item->update($request->all());

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

/**
* Remove the specified resource from storage.
*
* @param \BalajiDharma\LaravelMenu\Models\Menu $menu
* @param \BalajiDharma\LaravelMenu\Models\MenuItem $menuItem
* @param \BalajiDharma\LaravelMenu\Models\MenuItem $menuItem
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(Menu $menu, MenuItem $item)
{
$item->delete();

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

0 comments on commit 15b3484

Please sign in to comment.