### Access Theme Configuration and Helpers (PHP) Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt Provides examples of using helper functions to retrieve theme configuration values, access views, get URLs, and manage authentication. ```php // Get theme configuration value $layout = backpack_theme_config('layout'); // 'top_left' $headerClass = backpack_theme_config('classes.header'); // Get view with theme namespace $view = backpack_view('blank'); // 'backpack.theme-coreuiv4::blank' // Get theme URL $dashboardUrl = backpack_url('dashboard'); // '/admin/dashboard' // Check authentication if (backpack_auth()->check()) { $user = backpack_auth()->user(); } // Get authentication column $authColumn = backpack_authentication_column(); // 'email' $emailColumn = backpack_email_column(); // 'email' ``` -------------------------------- ### Switch to Another Theme (Bash) Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt Instructions for switching to a different Backpack theme, either by installing a new one or manually updating the configuration. ```bash # Install alternative theme php artisan backpack:require:theme-tabler # Or update config/backpack/ui.php manually # 'view_namespace' => 'backpack.theme-tabler::', ``` -------------------------------- ### Main Layout Example (top_left.blade.php) Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt Example Blade template for the 'top_left' main layout. It includes sections for head, sidebar, header, content, and scripts, using theme configuration for dynamic elements. ```blade {{-- resources/views/vendor/backpack/theme-coreuiv4/layouts/top_left.blade.php --}} @include(backpack_view('inc.head')) @include(backpack_view('inc.sidebar'))
@include(backpack_view('inc.main_header'))
@yield('before_breadcrumbs_widgets') @includeWhen(isset($breadcrumbs), backpack_view('inc.breadcrumbs')) @yield('after_breadcrumbs_widgets') @yield('header')
@yield('before_content_widgets') @yield('content') @yield('after_content_widgets')
@yield('before_scripts') @stack('before_scripts') @include(backpack_view('inc.scripts')) @include(backpack_view('inc.theme_scripts')) @yield('after_scripts') @stack('after_scripts') ``` -------------------------------- ### Install Theme CoreUI v4 via Artisan Source: https://github.com/laravel-backpack/theme-coreuiv4/blob/main/readme.md Automatically installs the Theme CoreUI v4 package for Laravel Backpack using the provided Artisan command. This is the recommended method for first-party themes. ```bash php artisan backpack:require:theme-coreuiv4 ``` -------------------------------- ### Install Theme CoreUI v4 via Composer Source: https://github.com/laravel-backpack/theme-coreuiv4/blob/main/readme.md Manually installs the Theme CoreUI v4 package using Composer. This is an alternative to the Artisan installation method. It requires subsequent configuration changes. ```bash composer require backpack/theme-coreuiv4 ``` -------------------------------- ### PHP Flash Notifications Example Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt Demonstrates how to use the Alert facade in PHP controllers to display flash notifications. These notifications can be of types success, error, warning, or info and will be shown to the user, typically as Noty toasts. ```php // In your controller \Alert::success('User created successfully')->flash(); \Alert::error('Something went wrong')->flash(); \Alert::warning('Please review the changes')->flash(); \Alert::info('New features available')->flash(); // Notifications appear as Noty toasts (top-right by default) ``` -------------------------------- ### Menu Item Component Usage Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt Illustrates how to use the `menu-item` component for creating navigation links in the sidebar or menu. It shows examples with title, icon, link, and active state management. ```blade {{-- Usage in sidebar or menu --}} ``` -------------------------------- ### Publish Theme CoreUI v4 Configuration Source: https://github.com/laravel-backpack/theme-coreuiv4/blob/main/readme.md Publishes the theme's configuration file to the application's config directory. This allows for optional customization of the theme's settings. Requires manual installation. ```bash php artisan vendor:publish --tag="theme-coreuiv4-config" ``` -------------------------------- ### JavaScript Manual Notification Display Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt An example of how to manually display a Noty notification using JavaScript. This is useful for triggering notifications directly from frontend scripts. The notification type and text can be customized. ```javascript new Noty({ type: 'success', text: 'Record saved successfully!' }).show(); ``` -------------------------------- ### Override Theme Blade File (Dashboard Example) Source: https://github.com/laravel-backpack/theme-coreuiv4/blob/main/readme.md Demonstrates how to override a specific theme blade file, in this case, 'dashboard.blade.php'. It involves creating a custom directory and copying the original file, allowing modifications without altering package files directly. ```bash # create the custom directory if it's not already there mkdir -p resources/views/vendor/backpack/theme-coreuiv4 # copy the blade file inside the folder we created above cp -i vendor/backpack/theme-coreuiv4/src/resources/views/dashboard.blade.php resources/views/vendor/backpack/theme-coreuiv4/dashboard.blade.php ``` -------------------------------- ### Blade: Add Menu Separator and Item Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt This example shows how to use the `x-backpack::menu-separator` and `x-backpack::menu-item` Blade components to visually separate sections in a menu and add individual menu items with icons and links. ```blade {{-- Visual separator in menu --}} ``` -------------------------------- ### PHP: Add Multiple Widgets to Dashboard Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt This PHP code example illustrates how to add multiple widgets to a Laravel Backpack dashboard by calling `Widget::add` multiple times within a controller method. It demonstrates adding three 'progress' widgets with different color schemes and metrics, each placed using `->to('before_content')`. ```php // app/Http/Controllers/Admin/DashboardController.php public function index() { Widget::add([ 'type' => 'progress', 'class' => 'card text-white bg-primary', 'value' => '512', 'description' => 'Registered Users', 'progress' => 75, ])->to('before_content'); Widget::add([ 'type' => 'progress', 'class' => 'card text-white bg-success', 'value' => '1,234', 'description' => 'Total Sales', 'progress' => 85, ])->to('before_content'); Widget::add([ 'type' => 'progress', 'class' => 'card text-white bg-warning', 'value' => '45', 'description' => 'Pending Orders', 'progress' => 30, ])->to('before_content'); return view(backpack_view('dashboard')); } ``` -------------------------------- ### Configure Backpack UI View Namespace Source: https://github.com/laravel-backpack/theme-coreuiv4/blob/main/readme.md Updates the Backpack UI configuration to use the CoreUI v4 theme's view namespace. This change is necessary after manual installation via Composer to point Backpack to the correct theme files. ```diff 'view_namespace' => 'backpack::', + 'view_namespace' => 'backpack.theme-coreuiv4::', ``` -------------------------------- ### Extend Service Provider for Assets and Widgets (PHP) Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt Demonstrates how to extend the application's service provider to add custom CSS/JavaScript files and register global widgets. ```php // app/Providers/AppServiceProvider.php use BackpackCRUDappLibraryWidget; public function boot() { // Add custom CSS \Backpack::addStyle('assets/css/custom-admin.css'); // Add custom JavaScript \Backpack::addScript('assets/js/custom-admin.js'); // Register global widgets Widget::add([ 'type' => 'progress', 'class' => 'card text-white bg-info', 'value' => 'Custom Widget', ])->to('before_content'); } ``` -------------------------------- ### Custom Page using Blank Template Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt Demonstrates creating a custom dashboard page by extending the theme's 'blank' layout. It shows how to define widgets for different content sections, such as 'before_content'. ```blade {{-- resources/views/admin/custom-dashboard.blade.php --}} @extends(backpack_view('blank')) @php $widgets = [ 'before_content' => [ [ 'type' => 'progress', 'class' => 'card text-white bg-primary', 'value' => '512', 'description' => 'Total Users', 'progress' => 75, 'hint' => '75% increase from last month', ], ], ]; @endphp @section('content')

Custom Dashboard

Your custom content goes here

@endsection ``` -------------------------------- ### Theme Configuration File Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt Defines default layout and CSS classes for various theme components. These settings can be customized in your `config/backpack/theme-coreuiv4.php` file. ```php // config/backpack/theme-coreuiv4.php return [ // Default layout for authenticated users 'layout' => 'top_left', 'classes' => [ 'header' => 'header app-header bg-light p-0 mb-0', 'body' => 'app aside-menu-fixed sidebar-lg-show', 'sidebar' => 'sidebar sidebar-dark sidebar-fixed bg-dark-gradient', 'footer' => 'app-footer d-print-none' ] ]; ``` -------------------------------- ### Breadcrumb Helper Usage (PHP/Blade) Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt Illustrates how to define breadcrumbs for a page using an array, which can then be rendered in a view. ```php // In your controller or view @php $breadcrumbs = [ trans('backpack::crud.admin') => backpack_url('dashboard'), 'Users' => backpack_url('user'), 'Edit User' => false, // Current page (no link) ]; @endphp ``` -------------------------------- ### Remove Theme Package (Bash) Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt Commands to uninstall the Backpack Theme CoreUI v4 package and revert configuration settings. ```bash # Remove composer package composer remove backpack/theme-coreuiv4 # Delete config file rm -rf config/backpack/theme-coreuiv4.php # Revert to default theme in config/backpack/ui.php # Change view_namespace back to: 'backpack::' ``` -------------------------------- ### Configure Backpack to Use Theme Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt Configures the Backpack UI settings to use the theme's view namespace. This ensures Backpack loads the theme's views instead of default ones. ```php // config/backpack/ui.php return [ 'view_namespace' => 'backpack.theme-coreuiv4::' ]; ``` -------------------------------- ### PHP: Add Progress White Widget Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt This PHP snippet shows how to add a 'progress_white' widget, likely intended for a dashboard, using the `Widget::add` facade. It configures the widget with specific styling, value, description, progress percentage, and hint text for a clean, white progress bar appearance. ```php // Dashboard widget with white progress bar styling Widget::add([ 'type' => 'progress_white', 'class' => 'card text-white bg-success', 'value' => '$45,678', 'description' => 'Revenue', 'progress' => 82, 'hint' => 'Current month', ])->to('before_content'); ``` -------------------------------- ### JavaScript Noty Configuration Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt This JavaScript code snippet configures the default settings for Noty.js, which is used by the theme for displaying notifications. It sets the layout to 'topRight', theme to 'backstrap', a timeout of 3500ms, and allows closing with click or button. ```javascript Noty.overrideDefaults({ layout: 'topRight', theme: 'backstrap', timeout: 3500, closeWith: ['click', 'button'], }); ``` -------------------------------- ### Configure Theme Classes (PHP) Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt Defines the CSS classes used for different layout elements of the theme. These can be customized in the configuration file. ```php // config/backpack/theme-coreuiv4.php return [ 'classes' => [ 'header' => 'header app-header bg-dark text-white p-0 mb-0', 'body' => 'app sidebar-fixed sidebar-lg-show', 'sidebar' => 'sidebar sidebar-light sidebar-fixed bg-white border-end', 'footer' => 'app-footer d-print-none bg-light', ], ]; ``` -------------------------------- ### PHP: Add Progress Widget Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt This PHP code demonstrates how to add a 'progress' widget to a Laravel Backpack view using the `Widget::add` facade. It specifies widget type, styling, content, and where to place it within the view structure. This is useful for displaying key metrics. ```php // In your controller or view Widget::add([ 'type' => 'progress', 'class' => 'card text-white bg-primary', 'wrapper' => ['class' => 'col-sm-6 col-lg-3'], 'value' => '1,234', 'description' => 'Total Orders', 'progress' => 65, 'hint' => '65% of monthly target', 'footer_link' => backpack_url('order'), 'footer_text' => 'View all orders', ])->to('before_content'); ``` -------------------------------- ### Bash Command for Blade File Overriding Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt This bash command demonstrates how to override a package's Blade view file in Laravel Backpack. It first creates the necessary directory structure in `resources/views/vendor/backpack/theme-coreuiv4` and then copies a specific Blade file from the package to the override location for customization. ```bash # Create vendor directory mkdir -p resources/views/vendor/backpack/theme-coreuiv4 # Copy and customize specific files cp -i vendor/backpack/theme-coreuiv4/resources/views/layouts/top_left.blade.php \ resources/views/vendor/backpack/theme-coreuiv4/layouts/top_left.blade.php # Edit the copied file - it will override the package version ``` -------------------------------- ### PHP Menu Item for My Account Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt This PHP code snippet shows how to create a menu item for the 'My Account' page in Laravel Backpack. It utilizes a Blade component for menu items, specifying the title, icon, and the route to the user account information page. ```php // Route: /admin/account/info // Allows users to update their name, email, and password // Usage in menu: ``` -------------------------------- ### Override Theme Settings Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt Allows overriding specific theme settings like header and sidebar classes within the `config/backpack/ui.php` file. This provides granular control over theme appearance. ```php // config/backpack/ui.php - Override specific theme classes return [ 'view_namespace' => 'backpack.theme-coreuiv4::', 'header_class' => 'header app-header bg-primary p-0 mb-0', 'sidebar_class' => 'sidebar sidebar-light sidebar-fixed bg-white' ]; ``` -------------------------------- ### Blade Login Form Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt This Blade template provides a pre-built login form for the Laravel Backpack application. It includes fields for email and password, with error handling and a remember me checkbox. The form submits to the '/admin/login' route. ```blade {{-- The theme provides a ready-to-use login page --}} {{-- Access at: /admin/login --}} {{-- To customize, copy to: resources/views/vendor/backpack/theme-coreuiv4/auth/login.blade.php --}} @extends(backpack_view('layouts.plain')) @section('content')

{{ trans('backpack::base.login') }}

@csrf
@error('email') {{ $message }} @enderror
@error('password') {{ $message }} @enderror
@endsection ``` -------------------------------- ### Blade: Create Nested Dropdown Menu Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt This code snippet demonstrates how to create a nested dropdown menu using the `x-backpack::menu-dropdown` and `x-backpack::menu-dropdown-item` Blade components. It's useful for organizing sub-menu items under a main navigation link. ```blade {{-- Nested dropdown menu --}} ``` -------------------------------- ### Blade: Customize Sidebar Navigation Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt This snippet illustrates how to customize the sidebar navigation in Laravel Backpack by using `x-backpack::menu-item`, `x-backpack::menu-separator`, and `x-backpack::menu-dropdown` components. It shows how to add dashboard links, content sections, and user-related dropdown menus. ```blade {{-- resources/views/vendor/backpack/theme-coreuiv4/inc/sidebar_content.blade.php --}} ``` -------------------------------- ### Blade: Use Widgets in Custom Sections Source: https://context7.com/laravel-backpack/theme-coreuiv4/llms.txt This Blade template shows how to integrate widgets into specific sections of a Laravel Backpack view using `@section` directives. It defines sections like `before_breadcrumbs_widgets`, `after_breadcrumbs_widgets`, `before_content_widgets`, and `after_content_widgets` to control widget placement. ```blade {{-- Use widgets in different sections of your page --}} @extends(backpack_view('blank')) @section('before_breadcrumbs_widgets') {{-- Widgets before breadcrumbs --}} @endsection @section('after_breadcrumbs_widgets') {{-- Widgets after breadcrumbs --}} @endsection @section('before_content_widgets') {{-- Widgets before main content --}} @endsection @section('after_content_widgets') {{-- Widgets after main content --}} @endsection ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.