Simple pages package for Laravel.
Via Composer
$ composer require jeroen-g/laravel-pages
The following command installs the package without the testing requirements.
$ composer require jeroen-g/laravel-pages --update-no-dev
Add the service provider in app/config/app.php
:
JeroenG\LaravelPages\LaravelPagesServiceProvider::class,
And in the same file, add the alias:
'LPages' => JeroenG\LaravelPages\Facades\LaravelPages::class,
To publish the package's migration files.
$ artisan vendor:publish
The last thing to do is to migrate:
$ artisan migrate
This package does not provide controllers and routes. To show pages you could use the route below. You'll need a page view to show the data from the database.
Route::get('{uri?}', function($uri)
{
if(LPages::pageExists($uri))
{
$pageData = LPages::getPage($uri);
return View::make('page', $pageData);
}
else
{
App::abort(404, 'Page Not Found');
}
});
Have a look at src\JeroenG\LaravelPages\LaravelPages.php
to see what this package can do and what each function needs. Everything is documented.