Package Data | |
---|---|
Maintainer Username: | webinfinita |
Maintainer Contact: | jorge@webinfinita.com (Jorge Garcia Coello) |
Package Create Date: | 2015-04-15 |
Package Last Update: | 2015-04-16 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-01-23 15:03:46 |
Package Statistics | |
---|---|
Total Downloads: | 15 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Note: Don't use this package just yet. Work in progress.
This is a simple blog package for laravel 5, the goal is to provide a starting point to a scalable blog post.
First we need to install it through composer
composer require "webinfinita/blog"
Then we need to add the service provider
// config/app.php
<?php
return [
...
...
'providers' => [
...
...
'Webinfinita\Blog\Providers\BlogServiceProvider',
],
];
Publish the migration and views
php artisan vendor:publish
We use a Trait to make a User have many Posts
// app/User.php
<?php namespace App;
...
use Webinfinita\Blog\Traits\HasManyPosts;
class User extends Model implements ... {
use Authenticatable, CanResetPassword, HasManyPosts;
...
In order to restrict access to a Post that doesn't belong to a user we need to add a register a Middleware
// app/Http/Kernel.php
<?php namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel {
...
protected $routeMiddleware = [
...
'post.owner' => 'Webinfinita\Blog\VerifyPostOwner',
];
}