بنقرة واحدة
admin-theme-development
// Admin theme development in Bagisto. Activates when creating custom admin themes, modifying admin layouts, building admin theme packages, or working with admin panel styling and interface customization.
// Admin theme development in Bagisto. Activates when creating custom admin themes, modifying admin layouts, building admin theme packages, or working with admin panel styling and interface customization.
Shop theme development in Bagisto. Activates when creating custom storefront themes, modifying shop layouts, building theme packages, or working with Vite-powered assets for the customer-facing side of the application.
Package development in Bagisto. Activates when creating packages, migrations, models, repositories, routes, controllers, views, localization, DataGrid, menus, ACL, or system configuration. Use references to skills for specific areas: @core, @data, @ui, @features.
Product type development in Bagisto. Activates when creating custom product types, defining product behaviors, or implementing specialized product logic. Use references: @config (product type configuration), @abstract (AbstractType methods), @build (complete subscription implementation).
Shipping method development in Bagisto. Activates when creating shipping methods, integrating shipping carriers like FedEx, UPS, DHL, or any third-party shipping provider; or when the user mentions shipping, shipping method, shipping carrier, delivery, or needs to add a new shipping option to checkout.
Payment gateway development in Bagisto. Activates when creating payment methods, integrating payment gateways like Stripe, PayPal, or any third-party payment processor; or when the user mentions payment, payment gateway, payment method, Stripe, PayPal, or needs to add a new payment option to the checkout.
Tests applications using the Pest 3 PHP framework in Bagisto. Activates when writing tests, creating unit or feature tests, adding assertions, testing Livewire components, architecture testing, debugging test failures, working with datasets or mocking; or when the user mentions test, spec, TDD, expects, assertion, coverage, or needs to verify functionality works.
| name | admin-theme-development |
| description | Admin theme development in Bagisto. Activates when creating custom admin themes, modifying admin layouts, building admin theme packages, or working with admin panel styling and interface customization. |
| license | MIT |
| metadata | {"author":"bagisto"} |
Admin theme development in Bagisto involves creating custom admin panel themes packaged as Laravel packages. The end result is a self-contained package that can be distributed and maintained independently.
Activate this skill when:
| Component | Purpose | Location |
|---|---|---|
| Theme Configuration | Defines available admin themes | config/themes.php |
| Views Path | Blade template files | Defined in theme config |
| Assets Path | CSS, JS, images | Defined in theme config |
| Admin Service Provider | Loads views and components | packages/Webkul/Admin/src/Providers/AdminServiceProvider.php |
// config/themes.php
'admin-default' => 'default',
'admin' => [
'default' => [
'name' => 'Default',
'assets_path' => 'public/themes/admin/default',
'views_path' => 'resources/admin-themes/default/views',
'vite' => [
'hot_file' => 'admin-default-vite.hot',
'build_directory' => 'themes/admin/default/build',
'package_assets_directory' => 'src/Resources/assets',
],
],
],
The end result should be a complete package with:
mkdir -p packages/Webkul/CustomAdminTheme/src/{Providers,Resources/views}
Copy all admin assets to your package to have full control:
# Copy complete admin assets folder
cp -r packages/Webkul/Admin/src/Resources/assets/* packages/Webkul/CustomAdminTheme/src/Resources/assets/
# Copy complete admin views folder
cp -r packages/Webkul/Admin/src/Resources/views/* packages/Webkul/CustomAdminTheme/src/Resources/views/
# Copy admin package.json for dependencies
cp packages/Webkul/Admin/package.json packages/Webkul/CustomAdminTheme/
This gives you:
After copying, create a custom dashboard page to show it's a new theme:
File: packages/Webkul/CustomAdminTheme/src/Resources/views/dashboard/index.blade.php
<x-admin::layouts>
<x-slot:title>
Custom Admin Dashboard
</x-slot>
<div class="flex gap-4 justify-between max-sm:flex-wrap">
<h1 class="py-[11px] text-xl text-gray-800 dark:text-white font-bold">
Custom Theme Dashboard
</h1>
<div class="flex gap-x-2.5 items-center">
<button class="secondary-button">
Reset to Defaults
</button>
<button class="primary-button">
Save Settings
</button>
</div>
</div>
{{-- Dashboard Content --}}
<div class="mt-8 bg-white dark:bg-gray-900 rounded-lg shadow p-6">
<h1 class="text-3xl font-bold text-gray-800 dark:text-white mb-6">
Welcome to Custom Admin Theme
</h1>
<p class="text-lg text-gray-600 dark:text-gray-300 mb-8">
Your customized Bagisto admin panel!
</p>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<div class="bg-blue-50 p-4 rounded-lg border border-blue-200">
<h3 class="text-xl font-semibold text-blue-800 mb-2">
Analytics
</h3>
<p class="text-blue-600">
Enhanced dashboard analytics and reporting
</p>
</div>
<div class="bg-green-50 p-4 rounded-lg border border-green-200">
<h3 class="text-xl font-semibold text-green-800 mb-2">
Orders
</h3>
<p class="text-green-600">
Streamlined order management interface
</p>
</div>
<div class="bg-purple-50 p-4 rounded-lg border border-purple-200">
<h3 class="text-xl font-semibold text-purple-800 mb-2">
Customers
</h3>
<p class="text-purple-600">
Enhanced customer management tools
</p>
</div>
</div>
</div>
</x-admin::layouts>
Create your own master layout for complete control:
File: packages/Webkul/CustomAdminTheme/src/Resources/views/layouts/master.blade.php
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ $title ?? config('app.name') }}</title>
{{-- Load assets manually for custom layouts --}}
@bagistoVite([
'src/Resources/assets/css/app.css',
'src/Resources/assets/js/app.js'
])
</head>
<body class="dark:bg-gray-900">
{{-- Custom sidebar --}}
@include('custom-admin-theme::layouts.sidebar')
<div class="flex">
{{-- Main content area --}}
<main class="flex-1 p-6">
{{ $slot }}
</main>
</div>
</body>
</html>
File: packages/Webkul/CustomAdminTheme/src/Providers/CustomAdminThemeServiceProvider.php
<?php
namespace Webkul\CustomAdminTheme\Providers;
use Illuminate\Support\ServiceProvider;
class CustomAdminThemeServiceProvider extends ServiceProvider
{
/**
* Register services.
*/
public function register(): void
{
//
}
/**
* Bootstrap services.
*/
public function boot(): void
{
// Publish views to resources/admin-themes/custom-admin-theme/views
$this->publishes([
__DIR__ . '/../Resources/views' => resource_path('admin-themes/custom-admin-theme/views'),
], 'custom-admin-theme-views');
}
}
Update composer.json:
"autoload": {
"psr-4": {
"Webkul\\CustomAdminTheme\\": "packages/Webkul/CustomAdminTheme/src"
}
}
Run: composer dump-autoload
Add to bootstrap/providers.php:
Webkul\CustomAdminTheme\Providers\CustomAdminThemeServiceProvider::class,
File: config/themes.php
'admin-default' => 'custom-admin-theme',
'admin' => [
'default' => [
'name' => 'Default',
'assets_path' => 'public/themes/admin/default',
'views_path' => 'resources/admin-themes/default/views',
'vite' => [
'hot_file' => 'admin-default-vite.hot',
'build_directory' => 'themes/admin/default/build',
'package_assets_directory' => 'src/Resources/assets',
],
],
'custom-admin-theme' => [
'name' => 'Custom Admin Theme',
'assets_path' => 'public/themes/admin/custom-admin-theme',
'views_path' => 'resources/admin-themes/custom-admin-theme/views',
'vite' => [
'hot_file' => 'admin-custom-vite.hot',
'build_directory' => 'themes/admin/custom-admin/build',
'package_assets_directory' => 'src/Resources/assets',
],
],
],
php artisan vendor:publish --provider="Webkul\CustomAdminTheme\Providers\CustomAdminThemeServiceProvider"
php artisan optimize:clear
# Navigate to package
cd packages/Webkul/CustomAdminTheme
# Install dependencies
npm install
# Build assets for production
npm run build
This will compile your admin theme assets and create the build directory. After building, your custom admin theme will be ready to use with the custom dashboard you created.
Create in your package root:
File: package.json
{
"name": "custom-admin-theme",
"private": true,
"description": "Custom Admin Theme Package for Bagisto",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"autoprefixer": "^10.4.14",
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.2",
"postcss": "^8.4.23",
"tailwindcss": "^3.3.2",
"vite": "^4.0.0"
}
}
File: vite.config.js
import { defineConfig, loadEnv } from "vite";
import laravel from "laravel-vite-plugin";
import path from "path";
export default defineConfig(({ mode }) => {
const envDir = "../../../";
Object.assign(process.env, loadEnv(mode, envDir));
return {
build: {
emptyOutDir: true,
},
envDir,
server: {
host: process.env.VITE_HOST || "localhost",
port: process.env.VITE_ADMIN_PORT || 5174,
cors: true,
},
plugins: [
laravel({
hotFile: "../../../public/admin-custom-vite.hot",
publicDirectory: "../../../public",
buildDirectory: "themes/admin/custom-admin/build",
input: [
"src/Resources/assets/css/app.css",
"src/Resources/assets/js/app.js",
],
refresh: true,
}),
],
};
});
File: tailwind.config.js
module.exports = {
content: [
"./src/Resources/**/*.blade.php",
"../../../resources/admin-themes/custom-admin-theme/**/*.blade.php"
],
theme: {
extend: {
colors: {
navyBlue: "#060C3B",
},
},
},
plugins: [],
};
File: postcss.config.js
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
File: config/bagisto-vite.php
'admin-custom-theme' => [
'hot_file' => 'admin-custom-vite.hot',
'build_directory' => 'themes/admin/custom-admin/build',
'package_assets_directory' => 'src/Resources/assets',
],
# Navigate to package
cd packages/Webkul/CustomAdminTheme
# Install dependencies
npm install
# Start dev server with hot reload
npm run dev
# Build for production
npm run build
Create symlink for real-time development without republishing:
# Remove published views
rm -rf resources/admin-themes/custom-admin-theme/views
# Create symlink from package to resources
ln -s $(pwd)/packages/Webkul/CustomAdminTheme/src/Resources/views resources/admin-themes/custom-admin-theme/views
Work directly in package and republish when needed:
# After making changes
php artisan vendor:publish --provider="Webkul\CustomAdminTheme\Providers\CustomAdminThemeServiceProvider" --force
<x-admin::layouts>
<x-slot:title>
Page Title
</x-slot>
{{-- Page Header --}}
<div class="flex gap-4 justify-between max-sm:flex-wrap">
<p class="py-[11px] text-xl text-gray-800 dark:text-white font-bold">
Page Heading
</p>
<div class="flex gap-x-2.5 items-center">
<button class="primary-button">
Action Button
</button>
</div>
</div>
{{-- Page content --}}
<div class="mt-8">
Content goes here
</div>
</x-admin::layouts>
The admin layout automatically provides:
primary-button, secondary-button)| Component | Usage | Description |
|---|---|---|
<x-admin::accordion> | Collapsible sections | Toggle content visibility |
<x-admin::button> | Action buttons | Loading states supported |
<x-admin::charts.bar> | Bar charts | Based on Chart.js |
<x-admin::charts.line> | Line charts | Based on Chart.js |
<x-admin::datagrid> | Data tables | Sorting, filtering, pagination |
<x-admin::drawer> | Slide-out panels | Position: top/bottom/left/right |
<x-admin::dropdown> | Dropdown menus | Position options available |
<x-admin::flat-picker.date> | Date picker | Based on Flatpickr |
<x-admin::flat-picker.datetime> | Date-time picker | Based on Flatpickr |
<x-admin::media.images> | Image upload | Multiple images support |
<x-admin::media.videos> | Video upload | Video support |
<x-admin::modal> | Dialog boxes | Header, content, footer slots |
<x-admin::quantity-changer> | Quantity input | +/- buttons |
<x-admin::seo> | SEO metadata | Meta title and description |
<x-admin::table> | Data tables | Customizable thead/tbody |
<x-admin::tabs> | Tab navigation | Position: left/right/center |
<x-admin::shimmer.*> | Loading effects | Skeleton loaders |
File: packages/Webkul/CustomAdminTheme/src/Resources/views/layouts/master.blade.php
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ $title ?? config('app.name') }}</title>
{{-- Load assets manually for custom layouts --}}
@bagistoVite([
'src/Resources/assets/css/app.css',
'src/Resources/assets/js/app.js'
])
</head>
<body class="dark:bg-gray-900">
{{-- Custom sidebar --}}
@include('custom-admin-theme::layouts.sidebar')
<div class="flex">
{{-- Main content area --}}
<main class="flex-1 p-6">
{{ $slot }}
</main>
</div>
</body>
</html>
packages/Webkul/CustomAdminTheme/
├── src/
│ ├── Providers/
│ │ └── CustomAdminThemeServiceProvider.php
│ └── Resources/
│ ├── assets/
│ │ ├── css/
│ │ │ └── app.css
│ │ ├── js/
│ │ │ └── app.js
│ │ ├── images/
│ │ └── fonts/
│ └── views/
│ ├── layouts/
│ │ └── master.blade.php
│ ├── dashboard/
│ │ └── index.blade.php
│ ├── components/
│ └── ...
├── package.json
├── vite.config.js
├── tailwind.config.js
└── postcss.config.js
| File | Purpose |
|---|---|
config/themes.php | Theme configuration |
config/bagisto-vite.php | Vite asset configuration |
packages/Webkul/Admin/src/Providers/AdminServiceProvider.php | Admin package registration |
packages/Webkul/Admin/src/Resources/views/components/* | Admin components |
packages/Webkul/Theme/src/Themes.php | Theme facade |
Test your admin theme by: