PHP code example of joaoolival / laravel-blog-engine

1. Go to this page and download the library: Download joaoolival/laravel-blog-engine library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

joaoolival / laravel-blog-engine example snippets


use Joaoolival\LaravelBlogEngine\Facades\Blog;

$posts = Blog::getPublishedPosts(perPage: 12);
$post = Blog::getPostBySlug('my-post');
$authors = Blog::getAllAuthors();
$categories = Blog::getAllCategories();

use Joaoolival\LaravelBlogEngine\Http\Resources\Posts\BlogPostResource;

return new BlogPostResource($post);

BlogPost::whereIsPublished()->get();
BlogPost::whereIsDraft()->get();
BlogPost::whereIsVisible()->get();
bash
composer blog-engine:install
php artisan storage:link
bash
php artisan vendor:publish --tag="laravel-blog-engine-config"
bash
php artisan make:policy BlogPostPolicy --model=\Joaoolival\LaravelBlogEngine\Models\BlogPost
bash
composer horizon:install
php artisan horizon
bash
php artisan blog:generate
bash
php artisan blog:generate --authors=3 --categories=5 --posts=50