Package Data | |
---|---|
Maintainer Username: | neilcrookes |
Maintainer Contact: | neil.crookes@fivebyfiveuk.com (Neil Crookes) |
Package Create Date: | 2013-11-19 |
Package Last Update: | 2015-04-28 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-12 15:01:58 |
Package Statistics | |
---|---|
Total Downloads: | 1,021 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 15 |
Total Watchers: | 6 |
Total Forks: | 6 |
Total Open Issues: | 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.
Add the following to you composer.json file
"fbf/laravel-pages": "dev-master"
Run
composer update
Add the following to app/config/app.php
'Fbf\LaravelPages\LaravelPagesServiceProvider'
Publish the config
php artisan config:publish fbf/laravel-pages
Run the migration
php artisan migrate --package="fbf/laravel-pages"
Create the relevant image upload directories that you specify in your config, e.g.
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
Check out the options in the src/config/config.php
file
By default, the routes file from the package will be automatically included, which matches all routes except the homepage.
However, the default route in the package will also override any of your app/routes.php
routes.
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.
You can use the excellent Laravel Administrator package by frozennode to administer your pages.
http://administrator.frozennode.com/docs/installation
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).
Let's say each page in your site can have a testimonial on 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');
});
}
}
<?php
class Page extends Fbf\LaravelPages\Page {
public function testimonial()
{
return $this->belongsTo('Fbf\LaravelTestimonials\Testimonial');
}
}
/**
* The class name of the Eloquent model that this config represents
*
* @type string
*/
'model' => 'Page',
...
'testimonial' => array(
'title' => 'Testimonial',
'type' => 'relationship',
'name_field' => 'title',
),
app/start/global.php
App::bind('Fbf\LaravelPages\PagesController', function() {
return new Fbf\LaravelPages\PagesController(new Page);
});