Please go to admin panel > Menus > select the menu and add items to it.

Laravel Blog Package

Enjoy the package

If you are looking for a wordpress laravel solution for your website to have a blogging system, I recommend to use a laravel CMS package instead. In this article I’ll show you how to install and use a great laravel blog package (laravel 8 blog) which adds blog functionality to your website and is compatible with latest Laravel version (now laravel 8). Firstly let me explain the problem which I encountered when I wanted to have a blog functionality for my laravel project.

My scenario has some requirements for a blog system, for example the blog functionality must support commenting, defining categories for posts (plus multi-level category support), being light-weight, giving front-end, and being flexible for further customization. Also preferably it’s better to use a free solution. I explained my options In “Feasible Solutions” section.

You can check the online demo before you install it yourself.

New Surprising Feature: Multi-language

Even WordPress and some other CMS platforms does not have multi-language support out-of-box. You may need to do some tricks to to implement that for your blog. For example, in WordPress you can use another instance along with your main WordPress instance for an additional language. Then you must sync databases. So, you have an extra burden to setup your blog system.

Hessam CMS has multi-language feature out-of-box. Easily use common languages and translate your posts.

We were planned to update the package on December first but we completed it sooner. All improvements are possible with your support 🙂

Live Demo

Try it now to check Hessam CMS features: https://cms.binshops.com/login

Table of Contents

Feasible Solutions

For the above mentioned requirements you have several solutions. Let’s see the solutions.

  • A package which provides your laravel website with blog functionality
  • Using some platforms which act as a basis for our website – actually they are a complete Laravel setup. Therefor these platforms have their own structure, and you need to learn their coding..
  • Integration with other blogging platforms – in this scenario you have your own models and business logics, and you connect these models to your blogging systems like WordPress. For example: you have access to your WordPress posts and your categories inside your laravel code, you can manipulate in your code and etc.
  • Using a separate blogging system – You have a blogging system (Joomla, Drupal, WordPress) along with your main laravel webasite. So you can link to your blog section (which is a link to your Joomla project) inside your main website (for example a /blog link in nav bar). Keep in mind that in this scenario blog users and your laravel users are separated.

So it’s up to you to choose among these solutions, but I prefer a solution which does not make me dependent to any platform, plus ease of customization. Preferably a laravel blog package (laravel 8 blog – laravel cms package). I explained the reasons in more detail in this article.

What others say..

“I was looking for quite a while for a Laravel CMS I could use that allowed me to use _all_ of Laravel’s current features.  Even the big ones like October are limited to operating on v6; I get it – they want the LTS version, but in my specific case it limited the ability to do want I wanted.

A key will be that it’s updated in line with Laravel to always work on the latest version.  None of the other CMSs work on anything above Laravel v6 – and some are stuck on v5.  That’s no good.

The way your system works, I can do exactly that.”

— Andrew Coghlan- Director at FullClarity

Laravel WordPress

Many websites use wordpress as their publishing platform. Regardless which framework you use for your website or web application (for example Django, Flask, Symfony, CodeIgniter, Spring Boot, MVC .Net, Ruby on Rails and even the most popular Laravel), it’s very common to use wordpress as publishing platform and CMS to have a blog and manage blog posts. In case of Laravel there are many Laravel CMS and publishing platforms like October. CMS platforms like October are very powerful and robust, but it’s not a good idea for existing websites and existing codes. They impose their own structures really they are a blogging frameworks over Laravel frameworks. So when you use them you do not feel comfortable. To work with them correctly you need to read more about them and learn additional concepts.

But easily you can add a Laravel CMS, to your website without worry about your models, business logic and existing code. Hessam CMS is a laravel package which provides your website with a blogging system like WordPress.


Hessam CMS Demo Video

In this video the installation process and a quick overview is shown. After following this video you have a nice blog system for your Laravel website.

Laravel Blog Package Demo Video

Preview For Admin Interface

laravel blog package create new post
Create new post
laravel blog package shows all posts in admin
Shows all posts in admin panel
laravl blog system adding a category
Add new category

Minimum Requirements

All of the requirements are installed during package installation.


Benefits

Everyone who use Laravel framework, can get benefit from this package. You can customize it and make any changes to fit your needs. So this works with your existing user and role management too.

This package gives you a dashboard to manage your blog and posts and a front-end to show your posts. So you can customize the blade templates to be fit with your UI. In other words I try to make admin UI familiar with WordPress admin panel. Actually working with this panel is much easier than working with WordPress admin panel.


Setup Instructions

  1. Install via composer
composer require hessam/laravel-blogger

For a fresh Laravel installation run the following too:

composer require laravel/ui
php artisan ui vue --auth
  1. Run the following two commands to copy config file, migration files, and view files
php artisan vendor:publish --provider="HessamCMS\HessamCMSServiceProvider"
  1. Execute migrations to create tables
php artisan migrate;
  1. You must add one method to your \App\User (in laravel 8 blog \App\Models\User) model. As the name of this method shows it determines which user can manage posts. Place your logic there.
 /**
     * Enter your own logic (e.g. if ($this->id === 1) to
     *   enable this user to be able to add/edit blog posts
     *
     * @return bool - true = they can edit / manage blog posts,
     *        false = they have no access to the blog admin panel
     */
    public function canManageHessamCMSPosts()
    {
        // Enter the logic needed for your app.
        // Maybe you can just hardcode in a user id that you
        //   know is always an admin ID?

        if (       $this->id === 1
             && $this->email === "your_admin_user@your_site.com"
           ){

           // return true so this user CAN edit/post/delete
           // blog posts (and post any HTML/JS)

           return true;
        }

        // otherwise return false, so they have no access
        // to the admin panel (but can still view posts)

        return false;
    }
  1. Create a directory in public/ named blog_images
  2. Setup your package. Enter this URL: /blog_admin/setup
  3. Congrats! Your blog is ready to use. (URLs are customizable in the config file)
    Admin panel URI: /blog_admin
    Front URI: /blog

I work on this package to add more features. I have some to-dos for this that I list it here. You can comment if you see something is missing or is necessary.

Star the package on github:


Full Package Support

I try to add more features and answer issues and fix bugs as soon as possible. Contact me to tell me which features you want, then I plan to create them (You will get response under 3 hour). Moreover I’m online most of the time feel free if you need tips, you can talk to me with online chat or other channels.

So it’s better to create an issue on Github to report a bug fix. Github Issues


Captcha

To enable or disable captcha, check captcha config in config/hessamcms.php file. A simple captcha system is created already, but you can add your logic or your replace the existing. To add your captcha system you have to implement CaptchaInterface and update the class in config/hessamcms.php file.

There are three methods which must be implemented in your class.

  • public function captcha_field_name(): Returns a string for form validation for example “captcha” <input name="..">.
  • public function view(): This returns the related view file which must be added into the appropriate blade file. The default file is hessamcms::captcha.basic.
  • public function rules(): Return an array for the rules (which are just the standard Laravel validation rules). This is where you can check if the captcha was successful or not. For example for google reCaptcha you must do server-side checking here.
  • Optional: public function runCaptchaBeforeShowingPosts(): This isn’t part of the interface, it isn’t required. By default it does nothing. But you can put some code in this method and it’ll be run in the HessamCMSReaderController::viewSinglePost method.

Release History / Recent Changes

  • Multi language support – version 9.x
  • Compatibility with Laravel 8 (laravel 8 blog) – version 8.0.x
  • New Admin UI – version 7.3.2
  • Multi-Level Category functionality – version 7.2.x
  • Ability to remove images from posts, updated CKEditor – version 7.1.8
  • Updated Fulltext search package – I added a feature to swisnl/laravel-fulltext package (through a pull request) to fix an issue in search functionality. It’s important to do the config setups to work this search properly, otherwise it returns blogs which are not published in search result – version 7.1.4
  • Support for custom user model – version 7.1.0
  • Made compatible with Laravel 6.x & 7.x – version 7.0.1

Conclusion

In conclusion, as a technical head or as a senior developer, you are responsible to choose appropriate technologies for your projects. So you use tools and packages which give you flexibility and ease of use. Definitely you do not want to deep dive into complex structures and development process. This package will save your time too much.

Share:

Comments

9 Comments

  • Hello,
    Thank you for this package which looks really good.
    For me the installation worked well and I was able to access “Blog” and “blog_admin”. I created categories and uploaded images, so far so good. But as soon as I create a Post, it saves itself well in the database, but if I go to “blog” or “blog_admin” I get the following message:
    Error
    Class ‘App\User’ not found (View: D:\wamp64\wwww\blog\resources\views\vendor\blogetc\partials\index_loop.blade.php)

    Do you know why I have this error?
    Thank you in advance for your help.
    stephane

  • hi,
    I solve the problem.
    In the file \configetc.php I had :
    ‘user_model’=>\App\User::class,

    I replaced with :
    ‘user_model’=>\App\Models\User::class,

    and everything now works perfectly.
    Stéphane

    • Hi Stéphane, happy that you found the solution for this issue.
      Yes this issue is for laravel 8, in latest laravel version the user model is relocated to \App\Models\.. . I try to keep package more compatible with LTS version of laravel.
      Many thanks for your consideration Stéphane.

  • Hi hessam,
    Is it possible to communicate with you directly by email?
    I tried several times to redo an installation of your package from scratch and each time I have the same concern when I want to go on blog_admin – 401 UNAUTHORIZED, then I am well connected, on the home page I have : Dashboard
    You are logged in!
    Thank you in advance for your response.
    Sincerely
    stephane

    • Hi Stephane,
      yes feel free to communicate with me by email, I’m available to ask everything you need.(hessam.modaberi@gmail.com)

      If you get this error.. it seems that you did not set the appropriate method in User model.
      You must add this method to your user model:

      public function canManageBlogEtcPosts()
          {
              // Enter the logic needed for your app.
              // Maybe you can just hardcode in a user id that you
              //   know is always an admin ID?
      
              if (       $this->id === 1
                   && $this->email === "your_admin_user@your_site.com"
                 ){
      
                 // return true so this user CAN edit/post/delete
                 // blog posts (and post any HTML/JS)
      
                 return true;
              }
      
              // otherwise return false, so they have no access
              // to the admin panel (but can still view posts)
      
              return false;
          }
      

      Many thanks

Leave a reply

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

Posts History