Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

App Business Slider Bundle Laravel Package

alphalemon/app-business-slider-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require alphalemon/app-business-slider-bundle
    

    Ensure alphalemon-cms-bundle is installed (as a dev dependency) and properly configured in your Laravel app.

  2. Publish Assets & Config

    php artisan vendor:publish --provider="AlphaLemon\BusinessSliderBundle\BusinessSliderBundle" --tag=config
    php artisan vendor:publish --provider="AlphaLemon\BusinessSliderBundle\BusinessSliderBundle" --tag=public
    

    This generates:

    • config/business_slider.php (default config)
    • Public assets (JS/CSS) in public/vendor/business-slider/
  3. First Use Case: Create a Slider

    • Register the slider content type in your CMS admin panel (via AlphaLemon’s UI).
    • Use the bundled editor to add slides (images, text, links, etc.).
    • Reference the slider in templates via:
      {{ alphalemon_content('slider_id', 'business_slider') }}
      

Implementation Patterns

Core Workflows

  1. Slider Creation & Management

    • Admin Panel: Use the bundled editor to:
      • Add/remove slides.
      • Configure slide transitions, timings, and responsive behavior.
      • Set global slider options (autoplay, navigation arrows, etc.).
    • API/CLI: For programmatic use, leverage AlphaLemon’s content API:
      $slider = \AlphaLemon\BusinessSliderBundle\Entity\Slider::find($id);
      $slides = $slider->getSlides(); // Collection of Slide entities
      
  2. Template Integration

    • Twig: Use the alphalemon_content helper or custom Twig extension:
      {% set slider = alphalemon_content('hero_banner', 'business_slider') %}
      {% for slide in slider.slides %}
          <img src="{{ slide.image.url }}" alt="{{ slide.title }}">
      {% endfor %}
      
    • Blade: Inject the slider via a service provider or directly:
      $slider = app('alphalemon.cms')->getContent('hero_banner', 'business_slider');
      
      @foreach($slider->slides as $slide)
          <img src="{{ $slide->image->url }}">
      @endforeach
      
  3. Dynamic Sliders

    • Fetch sliders by category/tag (if supported by AlphaLemon CMS):
      $sliders = \AlphaLemon\BusinessSliderBundle\Repository\SliderRepository::findByCategory('promotions');
      
  4. Event-Driven Extensions

    • Listen for slider events (e.g., slider.slide.added) to trigger custom logic:
      // In a service provider
      $dispatcher->addListener('slider.slide.added', function ($event) {
          // Log or process slide addition
      });
      

Integration Tips

  1. Asset Pipeline

    • Override default assets by publishing and extending the bundle’s JS/CSS:
      php artisan vendor:publish --tag=public --force
      
    • Customize via SASS/Less in your project’s assets.
  2. Localization

    • Translate slider labels/placeholders using AlphaLemon’s translation system:
      // resources/lang/en/business_slider.php
      {
          "slide_title": "Slide Title",
          "add_slide": "Add Slide"
      }
      
  3. Performance

    • Lazy-load slider images via loading="lazy" in Twig/Blade.
    • Use AlphaLemon’s cache system to store slider data:
      $cachedSlider = Cache::remember("slider_{$id}", 3600, function() use ($id) {
          return \AlphaLemon\BusinessSliderBundle\Entity\Slider::find($id);
      });
      
  4. Testing

    • Mock slider entities in PHPUnit:
      $slider = $this->createMock(\AlphaLemon\BusinessSliderBundle\Entity\Slider::class);
      $slider->method('getSlides')->willReturn([/* Slide entities */]);
      

Gotchas and Tips

Pitfalls

  1. Dependency Conflicts

    • Issue: alphalemon-cms-bundle (dev dependency) may cause autoloading errors if not properly installed.
    • Fix: Ensure composer.json includes:
      "require": {
          "alphalemon/alphalemon-cms-bundle": "dev-master"
      }
      
      Then run composer install.
  2. Missing Config

    • Issue: Sliders may not render if config/business_slider.php is missing.
    • Fix: Publish config explicitly:
      php artisan vendor:publish --tag=config --force
      
  3. Editor UI Quirks

    • Issue: The bundled editor may not persist custom slide attributes.
    • Fix: Extend the editor via JavaScript:
      // Override slide template in your custom JS
      AL.CMS.Editor.registerSlideTemplate('business_slider', function(slide) {
          return `<div class="custom-slide">
              <img src="${slide.image}">
              <h3>${slide.title}</h3>
              <button data-action="edit-slide">${slide.id}</button>
          </div>`;
      });
      
  4. Database Schema

    • Issue: Schema updates may fail if AlphaLemon’s migrations conflict with existing tables.
    • Fix: Run migrations in a specific order:
      php artisan migrate --path=vendor/alphalemon/alphalemon-cms-bundle/migrations
      php artisan migrate --path=vendor/alphalemon/app-business-slider-bundle/migrations
      

Debugging

  1. Slider Not Rendering

    • Check if the content type is registered in the CMS:
      SELECT * FROM alphalemon_content_types WHERE name = 'business_slider';
      
    • Verify the slider ID exists in alphalemon_contents.
  2. Editor JavaScript Errors

    • Clear cached assets:
      php artisan cache:clear
      php artisan view:clear
      
    • Check browser console for AL.CMS errors.
  3. Permission Issues

    • Ensure the user has ROLE_CONTENT_EDITOR in AlphaLemon’s security system.

Extension Points

  1. Custom Slide Types

    • Extend the Slide entity to add fields:
      // src/Entity/CustomSlide.php
      namespace App\Entity;
      use AlphaLemon\BusinessSliderBundle\Entity\Slide as BaseSlide;
      
      class CustomSlide extends BaseSlide {
          private $customField;
          // Add getters/setters and DB mapping
      }
      
    • Register the new type in config/business_slider.php:
      'slide_types' => [
          'default' => \AlphaLemon\BusinessSliderBundle\Entity\Slide::class,
          'custom'   => \App\Entity\CustomSlide::class,
      ],
      
  2. API Endpoints

    • Add routes in routes/business_slider.php:
      use AlphaLemon\BusinessSliderBundle\Controller\SliderController;
      
      Route::get('/api/sliders/{id}', [SliderController::class, 'show']);
      
  3. Validation Rules

    • Override slide validation in a service provider:
      $validator = \AlphaLemon\BusinessSliderBundle\Validator\SlideValidator::class;
      $validator->setRules([
          'image' => 'required|image|mimes:jpeg,png',
          'title' => 'required|max:100',
          'custom_field' => 'nullable|string',
      ]);
      
  4. Event Listeners

    • Subscribe to slider events in EventSubscriber:
      namespace App\EventSubscriber;
      use AlphaLemon\BusinessSliderBundle\Event\SliderEvents;
      
      class SliderSubscriber implements EventSubscriber {
          public static function getSubscribedEvents() {
              return [
                  SliderEvents::SLIDE_ADDED => 'onSlideAdded',
              ];
          }
          public function onSlideAdded($event) {
              // Custom logic
          }
      }
      
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver