A package to turn your litstack application into a CMS. Add new pages to your application via the litstack interface.



Litstack pages was created by Lennart Carstens-Behrens under the Sponsorware license.


Add the Litstack repository to your application's composer.json file:

"repositories": [
        "type": "composer",
        "url": ""

Install the package via composer:

composer require litstack/pages

Publish the migrations and migrate:

php artisan vendor:publish --provider="Litstack\Pages\PagesServiceProvider"

php artisan migrate

Setup a pages collection

With the artisan command lit:pages a new pages collection is created. For example blog:

php artisan lit:pages Blog

A config is created and two controllers, one for the backend in ./lit/app/Controllers/Pages and one for your application in ./app/Http/Controllers/Pages.

In the config you can configure the route prefix and the possible repeatabels. The url of the page consists of the route prefix specified in the config and the sluggified page title. So a route for the following case could be /blog/my-title. If the page is translatable a route is created for each locale specified in the config like so:

  • en/blog/{slug}
  • en/blog/{slug}
class BlogConfig extends PagesConfig

    public function appRoutePrefix(string $locale = null)
        return "blog";

    public function repeatables(Repeatables $rep)
        // Build your repeatables in here.

In the controller the page model is loaded with the method getFjordPage. This can now be passed to a view like this:

use Litstack\Pages\ManagesPages;
use Illuminate\Http\Request;

class PagesController
    use ManagesPages;

    public function __invoke(Request $request, $slug)
        $page = $this->getFjordPage($slug);

        return view('')->withPage($page);

Route Field

To be able to select the pages in a route field you must first add them to a route collection as described in the route field documentation.

FjordPages extends to Eloquent Collection with the helper method addToRouteCollection that lets you add a list of pages directly to a route collection:

use Ignite\Crud\Fields\Route;
use Litstack\Pages\Models\Page;

Route::register('app', function($collection) {
    Page::collection('blog')->get()->addToRouteCollection('Blog', $collection);
Join us on our discord server