2017 © Pedro Peláez
 

library laravel-pages

A Laravel 4 package for adding simple content managed pages to a website with banner image, heading, main image or YouTube video and body content.

image

fbf/laravel-pages

A Laravel 4 package for adding simple content managed pages to a website with banner image, heading, main image or YouTube video and body content.

  • Tuesday, April 28, 2015
  • by neilcrookes
  • Repository
  • 7 Watchers
  • 16 Stars
  • 1,013 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 1 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

Laravel-Pages

A Laravel 4 package for adding simple content managed pages to a website with banner image, heading, main image or YouTube video and body content., (*1)

Features

  • Pages can be draft or approved
  • They have a published date that you can set in the future for delayed/scheduled publishing
  • Page uris are automatically generated from the page heading on create, but can be edited
  • Page uris can include '/' to denote sections of a website
  • Configurable route matching pattern (by default it's everything except the root route, i.e. '/')
  • Control page title, meta description and keywords for SEO purposes
  • Uses soft deletes in case you need to retrieve old content
  • Configure the rendered view so you can use one in your app rather than the one in the package
  • Make use of 2 partials in your own view so you can add extra stuff around the banner image and the content area

Comes with a

  • Migration for creating the fbf_pages table
  • Model, controller and view (main view and 2 partials for content and banner image)
  • Built in route (currently catches anything from the root of the site, so include the ServiceProvider last in the list if other packages have routes that this would interfere with)
  • Service provider that automatically registers the eloquent sluggable package

Installation

Add the following to you composer.json file, (*2)

"fbf/laravel-pages": "dev-master"

Run, (*3)

composer update

Add the following to app/config/app.php, (*4)

'Fbf\LaravelPages\LaravelPagesServiceProvider'

Publish the config, (*5)

php artisan config:publish fbf/laravel-pages

Run the migration, (*6)

php artisan migrate --package="fbf/laravel-pages"

Create the relevant image upload directories that you specify in your config, e.g., (*7)

public/uploads/packages/fbf/laravel-pages/banner/originals
public/uploads/packages/fbf/laravel-pages/banner/resized
public/uploads/packages/fbf/laravel-pages/main/originals
public/uploads/packages/fbf/laravel-pages/main/resized

Configuration

Check out the options in the src/config/config.php file, (*8)

Routes configuration

By default, the routes file from the package will be automatically included, which matches all routes except the homepage., (*9)

However, the default route in the package will also override any of your app/routes.php routes., (*10)

To avoid this, if you have app routes, you can configure it to not use the package's built-in routes file, and then just copy the routes from the package to your own app/routes.php file, but after your existing routes., (*11)

Administrator

You can use the excellent Laravel Administrator package by frozennode to administer your pages., (*12)

http://administrator.frozennode.com/docs/installation, (*13)

A ready-to-use model config file for the Page model (pages.php) is provided in the src/config/administrator directory of the package, which you can copy into the app/config/administrator directory (or whatever you set as the model_config_path in the administrator config file)., (*14)

Extending

Let's say each page in your site can have a testimonial on it., (*15)

  • After installing the package you can create the testimonials table and model etc (or use the fbf/laravel-testimonials package)
  • Create the migration to add a testimonial_id field to the fbf_pages table, and run it
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class LinkPagesToTestimonials extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('fbf_pages', function(Blueprint $table)
        {
            $table->integer('testimonial_id')->nullable()->default(null);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('fbf_pages', function(Blueprint $table)
        {
            $table->dropColumn('testimonial_id');
        });
    }

}
  • Create a model in you app/models directory that extends the package model and includes the relationship
<?php

class Page extends Fbf\LaravelPages\Page {

    public function testimonial()
    {
        return $this->belongsTo('Fbf\LaravelTestimonials\Testimonial');
    }

}
  • If you are using FrozenNode's Administrator package, update the pages config file to use your new model, and to allow selecting the testimonial to attach to the page:
    /**
     * The class name of the Eloquent model that this config represents
     *
     * @type string
     */
    'model' => 'Page',

..., (*16)

        'testimonial' => array(
            'title' => 'Testimonial',
            'type' => 'relationship',
            'name_field' => 'title',
        ),
  • Finally, update the IoC Container to inject an instance of your model into the controller, instead of the package's model, e.g. in app/start/global.php
App::bind('Fbf\LaravelPages\PagesController', function() {
    return new Fbf\LaravelPages\PagesController(new Page);
});

The Versions

28/04 2015

dev-multilingual

dev-multilingual

A Laravel 4 package for adding simple content managed pages to a website with banner image, heading, main image or YouTube video and body content.

  Sources   Download

MIT

The Requires

 

25/02 2014

dev-master

9999999-dev

A Laravel 4 package for adding simple content managed pages to a website with banner image, heading, main image or YouTube video and body content.

  Sources   Download

MIT

The Requires

 

25/02 2014

v0.5.2

0.5.2.0

A Laravel 4 package for adding simple content managed pages to a website with banner image, heading, main image or YouTube video and body content.

  Sources   Download

MIT

The Requires

 

07/02 2014

v0.5.1

0.5.1.0

A Laravel 4 package for adding simple content managed pages to a website with banner image, heading, main image or YouTube video and body content.

  Sources   Download

MIT

The Requires

 

03/02 2014

v0.5.0

0.5.0.0

A Laravel 4 package for adding simple content managed pages to a website with banner image, heading, main image or YouTube video and body content.

  Sources   Download

MIT

The Requires

 

29/01 2014

v0.4.0

0.4.0.0

A Laravel 4 package for adding simple pages to a website with banner image, heading, main image or YouTube video and body content.

  Sources   Download

MIT

The Requires

 

29/01 2014

v0.3.1

0.3.1.0

A Laravel 4 package for adding simple pages to a website with banner image, heading, main image or YouTube video and body content.

  Sources   Download

MIT

The Requires

 

29/01 2014

v0.3.0

0.3.0.0

A Laravel 4 package for adding simple pages to a website with banner image, heading, main image or YouTube video and body content.

  Sources   Download

MIT

The Requires

 

14/01 2014

v0.2.0

0.2.0.0

A Laravel 4 package for adding simple pages to a website with banner image, heading, main image or YouTube video and body content.

  Sources   Download

MIT

The Requires

 

10/01 2014

v0.1.0

0.1.0.0

A Laravel 4 package for adding simple pages to a website with banner image, heading, main image or YouTube video and body content.

  Sources   Download

MIT

The Requires