PHPackages                             bociancz/slider-module - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. bociancz/slider-module

ActiveAsgard-module

bociancz/slider-module
======================

Slider module for AsgardCMS

v3.4.2(5y ago)72.6k19[5 issues](https://github.com/BocianCZ/Slider/issues)[1 PRs](https://github.com/BocianCZ/Slider/pulls)MITPHPPHP &gt;=5.6

Since Oct 10Pushed 1y ago3 watchersCompare

[ Source](https://github.com/BocianCZ/Slider)[ Packagist](https://packagist.org/packages/bociancz/slider-module)[ RSS](/packages/bociancz-slider-module/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (56)Used By (0)

Slider Module
=============

[](#slider-module)

IMPORTANT: Slider Module for AsgardCMS v1 and v2 is no longer maintained
------------------------------------------------------------------------

[](#important-slider-module-for-asgardcms-v1-and-v2-is-no-longer-maintained)

For Asgard v1, use `0.x` tagged releases, for Asgard v2 use `2.x` tagged releases. Please upgrade Asgard to v3 if you wish to use the latest features (see [changelog in releases](https://github.com/BocianCZ/slider-module/releases) for details)

Special Thanks
--------------

[](#special-thanks)

to Nicolas Widart for [AsgardCMS](https://github.com/AsgardCms) and his [Menu Module](https://github.com/AsgardCms/Menu), that was used as a foundation for the Slider Module. All other contributors to this module

Installation
------------

[](#installation)

### Using Asgard module downloader

[](#using-asgard-module-downloader)

Module can be installed by running following command: `php artisan asgard:download:module bociancz/slider`

Please DO NOT USE `bociancz/slider-module` as a package name when using Asgard module downloader. This will put module in `Modules/SliderModule` directory, which is not correct. Using `bociancz/slider` should do the trick.

### Using Composer

[](#using-composer)

You can install Slider module using composer: `composer require bociancz/slider-module`

After the module is installed, Slider migrations should be installed automatically, as well as frontend assets. If by any chance they are not, you can run commands manually:

- to install Slider migrations `php artisan module:migrate Slider`
- to publish frontend assets `php artisan module:publish Slider`

Do not forget to give yourself access in AsgardCMS (using Roles/Permissions). New Slider item will appear in the Sidebar

Usage
-----

[](#usage)

### Prerequisites

[](#prerequisites)

By default, Slider module is created using [Bootstrap Carousel](https://getbootstrap.com/docs/4.0/components/carousel/)so make sure you have all prerequisites loaded for standard Bootstrap carousel (Bootstrap Carousel CSS and JS)

### Basic Usage

[](#basic-usage)

You can create basic Slider using the AsgardCMS admin interface - you can create and name your slider (pay attention to the **System Name** field here, it is used later for rendering), and create individual slides. Slides can be linked to images in the Media module, or have URL pointing to external image. They can also contain hyperlink to any page on the site, fixed URI or URL.

When the slider is created, you can render it in your template using `{!! Slider::render('slider_system_name') !}}`

### Advanced Usage

[](#advanced-usage)

#### Use your own slider template

[](#use-your-own-slider-template)

If you want to change rendering of your slider, use custom HTML, CSS classes, etc, you can pass a Blade template name as a second parameter to the `render()` method, i.e. `{!! Slider::render('slider_system_name', 'slider/my-own-slider') !}}`

Template may look like this:

```
{-- Themes/MyTheme/views/slider/my-own-slider.blade.php --}

    @foreach($slider->slides as $index => $slide)

    @endforeach

```

You will have `Modules\Slider\Entities\Slider` instance available in the `$slider` variable

#### Provide your own Slider instance

[](#provide-your-own-slider-instance)

You can also pass a `Modules\Slider\Entities\Slider` instance as a first parameter instead of the slider `system_name` to render dynamically created slider.

First, create instance of your slider and add slides in your controller and pass it to the view

```
