2017 © Pedro Peláez
 

library laravel-pages

image

gbrock/laravel-pages

  • Thursday, August 20, 2015
  • by gbrock
  • Repository
  • 1 Watchers
  • 10 Stars
  • 209 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Pages Build Status

A Laravel 5.1 package designed to add pages to your Laravel application. A page is just content defined by specific URL, or slug. A page may or may not be published., (*1)

Installation

  1. Run composer require gbrock/laravel-pages from your project directory.
  2. Add the service provider to the providers array in config/app.php:
    Gbrock\Pages\Providers\PageServiceProvider::class,, (*2)

  3. Publish the migrations, views, and config file:
    php artisan vendor:publish --provider="Gbrock\Pages\Providers\ContactableServiceProvider", (*3)

  4. Run the migrations:
    php artisan migrate, (*4)

Usage

Creating a Public Page

Create a Page model:, (*5)

\Gbrock\Pages\Models\Page::create([
    'title' => 'Hello, World',
    'content' => '<p>Hi everybody</p>',
    'public' => true,
]);

...which is now accessible by browsing to /hello-world!, (*6)

Making a Domain

A domain is a set of pages which are always under a specific slug. For example, you might make a "BlogPage" model whose members are always accessible under blog/{slug}:, (*7)

<?php

namespace App;

use Gbrock\Pages\Models\Page;
use Gbrock\Pages\Traits\Domainable;

class BlogPage extends Page {

    use Domainable;

    protected static $domain = 'blog';

}

Then you can query that model for only that domain of pages. Please note that, by default, domained pages will be included in queries when using the above Page model. In order to ignore domained pages, extend the included Page model and add ignorable domains to the $subdomains property:, (*8)

<?php

namespace App;

use Gbrock\Pages\Models\Page as BasePage;

class Page extends BasePage
{
    protected static $subdomains = ['blog'];
}

The Versions

20/08 2015

dev-master

9999999-dev

  Sources   Download

The Requires

 

The Development Requires

19/08 2015
19/08 2015