A minimal blogging package for Laravel
<a href="https://travis-ci.org/talvbansal/easel" target="_blank">
<img src="https://api.travis-ci.org/talvbansal/easel.svg" alt="Build Status" />
</a>
<a href="https://styleci.io/repos/63001540" target="_blank">
<img src="https://styleci.io/repos/63001540/shield?style=flat" alt="Style CI" />
</a>
<a href="https://github.com/talvbansal/easel/issues" target="_blank">
<img src="https://img.shields.io/github/issues/talvbansal/easel.svg" alt="Issues" />
</a>
<a href="https://packagist.org/packages/talvbansal/easel" target="_blank">
<img src="https://poser.pugx.org/talvbansal/easel/downloads" alt="Downloads" />
</a>
<a href="https://insight.sensiolabs.com/projects/06d23269-ac1d-4465-b542-9c38b31f8d91" target="_blank">
<img src="https://img.shields.io/sensiolabs/i/06d23269-ac1d-4465-b542-9c38b31f8d91.svg?style=flat" alt="SensioLabsInsight"/>
</a>
<a href="https://github.com/talvbansal/easel/blob/master/licence" target="_blank">
<img src="https://poser.pugx.org/talvbansal/easel/license" alt="License" />
</a>
- PHP >= 5.6
- Composer
- An existing Laravel 5.3 project
-
You can download Easel using composer
composer require talvbansal/easel
-
To register the
easel:install
andeasel:update
artisan commands as well as the new routes for Easel to work, you will need to add the Easel service provider to yourconfig/app.php
file\Easel\Providers\EaselServiceProvider::class,
-
To install Easel into your project run the following command, this will publish all the application assets and database migrations / factories / seeds required, the migrations will automatically be run from this command
php artisan easel:install
-
Finally you'll need to seed your database to create the default admin user and initial post
php artisan db:seed
-
Update your
config/auth.php
file to use Easel's built in User Model (Easel\Models\User
)'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => Easel\Models\User::class, ], ],
Or alternatively configure Easel to use your own Custom User Model
-
Sign into Easel using the default credentials:
- Email
admin@easel.com
- Password
password
- Email
-
Head over to the profile page and update your details and password!
-
Start blogging!
-
Whenever an update to Easel is made internal files will automatically be updated when a composer update is run, however new views and assets will only be published / republished with the following command
php artisan easel:update
-
You could also add the above command to your post-update-cmd in your projects
composer.json
file"post-update-cmd": [ "Illuminate\\Foundation\\ComposerScripts::postUpdate", "php artisan easel:update", "php artisan optimize" ]
Every app is different and Easel has been designed to be customisable. Be sure to check out the config/easel.php
for a complete list of configurable options.
-
Since Easel is designed to be the starting point for a new project or added into an existing one, you can decide to use the built in
User
model (Easel\Models\User
) or use an existingUser
model with a few alterations. -
If you want to use the build in User model (
Easel\Models\User
) you'll need to set it in theconfig/auth.php
file'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => Easel\Models\User::class, ], ],
If you want to use an existing model you'll need to make the following changes to it:
-
Your User model will need implement the
Easel\Models\BlogUserInterface
and also use theEasel\Models\EaselUserTrait
-
You will also need to add the key
birthday
to the$dates
property of your user modelclass User extends Model implements \Easel\Models\BlogUserInterface{ use Easel\Models\EaselUserTrait; protected $dates = ['birthday']; }
-
Then finally update the
config/easel.php
config file use your User model'user_model' => \My\Custom\User::class,
By default you can access the blog list and posts at the following routes:
/blog
/blog/{blog-post-slug}
However you might want the blog to accessed from a different URI, Easel lets you configure that by adding the following key BLOG_BASE_URL
to your .env
file, for example:
BLOG_BASE_URL=/myblog
The above changes will make your blog respond at
/myblog
/myblog/{blog-post-slug}
If you want the blog to respond at the '/'
route you will need to add a new route to your routes.php
file as follows:
Route::get('/', '\Easel\Http\Controllers\Frontend\BlogController@index');
When creating a blog post you can use the default
layout for Easel, however it is likely that you'll want to amend the views to suit your application.
You may also need different views for different blog posts - Easel has you covered! just add the BLOG_POST_LAYOUTS
key to your .env
file and give it the path to a folder within your resources/views
folder
For example
BLOG_POST_LAYOUTS=layouts.blog.posts
Will point to the following folder
{project}/resources/views/layouts/blog/posts
- Every blade template within that folder will then be listed on the post creation page as a potential layout for that post.
- Sub-folders within the
BLOG_POST_LAYOUTS
folder will not be listed allowing you to store partials for your templates within that single folder structure.
You can also set the blog post list layout using the BLOG_POST_LIST
key, which again points to a corresponding view within your resources/views
folder
BLOG_POST_LIST=layouts.blog.list