Fliter Post by Author – WordPress-Like Blog Laravel 5.7 and AdminLTE 3 (7)

WordPress-Like Blog Laravel 5.7 and AdminLTE 3 (7) – Filter Post by Author

In this seventh part, we will :

  1. Filter the post based on author
  2. Utilize Gravater

Filter the Post by Author

With this feature, the visitor will be able to see the post written by certain author when they click the author name on the post. First, we add route/web.php :

Open BlogController.php and add author() method :

Add slug column to users table :

Run the migration : php artisan migrate

Add slug to UsersTableSeeder.php

Run the seed : php artisan db:seed

Open User model and add getRouteKeyName() method :

Modify index.blade.php

Also modify show.blade.php :

Next, add bio column to users table :

Run the migration : php artisan migrate.

Add bio using UsersTableSeeder.php , don’t forget to add the namespace use Faker\Factory

Run the seed : php artisan db:seed

Open User.php and add gravatar() and bioHtml method :

Don’t forget to copy markdown namespace : use GrahamCampbell\Markdown\Facades\Markdown;

Afterwards, we will use gravatar to add picture to author bio. Open gravatar.com and register your email. Modify show.blade.php :

Open your project, send me a comment if you encounter any error.

Github Commit.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.