Laravel Blog Package. Easiest way to add a blog to your Laravel website. A package which adds wordpress functionality to your website and is compatible with laravel 8.

Overview

Laravel Blog

Have you worked with Wordpress? Developers call this package wordpress-like laravel blog.

Contact us for any customization:

[email protected]

Lightweight and Comprehensive

Incredible features with a lightweight laravel blog package. I highly recommend it because:

  • Quick installation (<3 minutes)
  • It's very easy to extend
  • Included great features out-of-box
  • Its simplicity allows to be easily made compatible with latest laravel
  • No additional concept except laravel knowledge
  • Compatible with other Laravel platforms like Bagisto

Outstanding Features

  • Fulltext Search - search throughout all blog posts
  • Multi Level Category - nested sets using Baum
  • Multi Language Support

Quick and easy installation (Multi-lang version)

1- Install via composer

composer require binshops/laravel-blog

For a fresh Laravel installation run the following too:

composer require laravel/ui
php artisan ui vue --auth

2- Run the following two commands to copy config file, migration files, and view files

php artisan vendor:publish --provider="BinshopsBlog\BinshopsBlogServiceProvider"

3- Execute migrations to create tables

php artisan migrate;

4- You must add one method to your \App\User (in laravel 8 \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 canManageBinshopsBlogPosts()
    {
        // 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;
    }

5- Create a directory in public/ named blog_images

6- Login as admin and setup your package: /blog_admin/setup

Congrats! Your blog is ready to use. (URLs are customizable in the config file)

Admin panel URI: /blog_admin Front URI: /en/blog

To see package on Packagist click this Link

Single Language Version

To install the single language version of the package use version v8.1x:

1- composer require binshops/laravel-blog:v8.1.2

2- php artisan vendor:publish --provider="BinshopsBlog\BinshopsBlogServiceProvider"

3- php artisan vendor:publish --tag=laravel-fulltext

4- php artisan migrate;

You can see the single version in "single-lang" branch.

Important Notes

  • For laravel 8.x's default auth User model, change user model in binshopsblog.php to: \App\Models\User::class

Features

  • Compatible with latest laravel version (laravel 8.x)
  • Backward-compatibility with previous laravel versions
  • Full text search - searching throughout the blog posts
  • Multi-level category support
  • fully configurable via its config/binshopsblog.php config file
  • Ready to use admin panel
  • Full customizability of admin views and front views
  • Paginated views
  • Ability to upload images
  • Managing posts, categories
  • Managing comments and comment approval
  • Other options include using Disqus comments or disabling comments

Recent Changes

  • 9.1.x Multi language support
  • 8.0.x Compatibility with Laravel 8.x

What/who this package is for:

  • For websites running Laravel
  • Who wants to have a site blog. This laravel blog gives an easy to use interface to write blog posts/assign categories/manage existing posts
  • Where only admin users can edit/manage the blog (this is not suitable for every user on your site to be able to manage posts)
  • For anyone who likes to add a wordpress-like laravel blog to laravel website

How to customise the blog views/templates

After doing the correct vendor:publish, all of the default template files will be found in /resources/views/vendor/binshopsblog/ and are easy to edit to match your needs.

Customizing admin views

If you need to customize the admin view, just copy the files from vendor/binshopsblog/src/Views/binshopsblog_admin to resources/views/vendor/binshopsblog_admin Then you can modify them just like any other view file.

Routes

It will auto set all required routes (both public facing, and admin backend). There are some config options (such as changing the /blog/ url to something else), which can be done in the binshopsblog.php file.

Config options

All config options have comments which describe what they do. Please just refer to the binshopsblog.php file in your /config/ dir.

Custom User Model

You can change the default user model through the config file.

Events

You can find all the events that are fired by looking in the /src/Events directory.

Add these (and an Event Listener) to your EventServiceProvider.php file to make use of these events when they fire.

Built in CAPTCHA / anti spam

There is a built-in captcha (anti-spam comment) system built in, which will be easy for you to replace with your own implementation.

There is a basic anti-spam captcha function built-in.

See the config/binshops.php captcha section. There is a built in system (basic!) that will prevent most automated spam attempts. Writing your own captcha system:

I wrote the captcha system simple on purpose, so you can add your own captcha options. It should be easy to add any other captcha system to this.

If you want to write your own implementation then create your own class that implements \BinshopsBlog\Interfaces\CaptchaInterface, then update the config/binshopsblog.php file (change the captcha_type option).

There are three methods you need to implement: public function captcha_field_name() : string

Return a string such as "captcha". It is used for the form validation and . public function view() : string

What view file should the binshops::partials.add_comment_form view include? You can set this to whatever you need, and then create your own view file. The default included basic captcha class will return "binshops::captcha.basic". public function rules() : array

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. Optional: public function runCaptchaBeforeShowingPosts() : null

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 BinshopsReaderController::viewSinglePost method.

Image upload errors

Try adding this to config/app.php:

'Image' => Intervention\Image\Facades\Image::class
  • Also make sure that /tmp is writable. If you have open_basedir enabled, be sure to add :/tmp to its value.
  • Ensure that /public/blog_images (or whatever directory you set it to in the config) is writable by the server
  • You might need to set a higher memory limit, or upload smaller image files. This will depend on your server. I've used it to upload huge (10mb+) jpg images without problem, once the server was set up correctly to handle larger file uploads.

Version History

  • 9.2.x Stable version of package
  • 9.0.x Multi-language support beta release
  • 8.0.x Compatibility with Laravel 8
  • 7.3.0 New Admin UI
  • 3.0.1 - replaced all short tags (<?) with full opening ones (<?php)
  • 2.0 - added full text search (enable it via the config file - it is disabled by default).
  • 1.1.1 - added basic captcha
  • 1.0.5 - composer.json changes.
  • 1.0 - First release
  • 0.1 - Initial release

Contributors


Sam Berry


Alef Barbeli

Comments
  • Issue when listing all blogs

    Issue when listing all blogs

    i can add the posts successfully but now i am facing another issue when showing all the blog posts on homepage on this url en/blog. i can see the below error:

    Too few arguments to function HessamCMS\Models\HessamPostTranslation::url(), 0 passed in /var/www/html/ski_pro_web/vendor/hessam/laravel-blogger/src/Models/HessamPostTranslation.php on line 129 and exactly 1 expected (View: /var/www/html/ski_pro_web/resources/views/vendor/hessamcms/partials/index_loop.blade.php)

    opened by Naveedali1234 13
  • Issue during setup

    Issue during setup

    Hi :)

    thank you for the amazing package.

    i am trying to install it. After accessing the url /blog_admin/setup and making the English language as default language and clicking on setup package button, i am getting the following error:

    SQLSTATE[42703]: Undefined column: 7 ERROR: column "id" does not exist LINE 1: ...ed_at", "created_at") values ($1, $2, $3, $4) returning "id" ^ (SQL: insert into "hessam_configurations" ("key", "value", "updated_at", "created_at") values (INITIAL_SETUP, 1, 2021-01-21 08:17:56, 2021-01-21 08:17:56) returning "id")

    opened by Naveedali1234 9
  • installation failed

    installation failed

    Hello i'm facing this error while runing composer require hessam/laravel-blogger

     Error
    
      Class 'HessamCMS\Laravel\Fulltext\ModelObserver' not found
    
      at vendor/hessam/laravel-blogger/src/HessamCMSServiceProvider.php:33
         29▕     {
         30▕
         31▕         if (config("hessamcms.search.search_enabled") == false) {
         32▕             // if search is disabled, don't allow it to sync.
      ➜  33▕             ModelObserver::disableSyncingFor(HessamPostTranslation::class);
         34▕         }
         35▕
         36▕         if (config("hessamcms.include_default_routes", true)) {
         37▕             include(__DIR__ . "/routes.php");
    
          +7 vendor frames
      8   [internal]:0
          Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(HessamCMS\HessamCMSServiceProvider))
    
          +5 vendor frames
      14  artisan:37
          Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
    
    Installation failed, reverting ./composer.json and ./composer.lock to their original content.
    
    
    opened by mohamed-ea 9
  • Laravel 9 composer file issue

    Laravel 9 composer file issue

    Hello, thank you for this great package. I am having a problem with the installation. the command: composer require binshops/laravel-blog generates an error because I am using a later version of eloquent-sluggable. my composer file contains "cviebrock/eloquent-sluggable": "^9.0", Your composer file restricts the latest version to 8: "cviebrock/eloquent-sluggable": "~8.0|~7.0|~6.0|~4.8|~4.7|~4.6|~4.5", Please updade this so that I can automate the deployment

    Kind thanks Dale

    laravel9 
    opened by JustAnotherFalseProphet 5
  • Error in sluggable function

    Error in sluggable function

    I tried to add laravel-blog into my laravel project

    Laravel version 8.49.0 laravel-blog version: 8.1.2

    but I got this error Declaration of BinshopsBlog\Models\BinshopsBlogPost::sluggable() must be compatible with Cviebrock\EloquentSluggable\Sluggable::sluggable(): array

    I found solution here

    I think the solution is to change vendor/binshops/laravel-blog/src/Models/BinshopsBlogPost.php (line 61)

    public function sluggable(): array
    {
     ... ...
    }
    

    I used DO app for server

    unfortunately, DO app doesn't support editing package files

    opened by smart0120 5
  • post detail not show the style as created

    post detail not show the style as created

    Thanks much for package, I was create a post with different style like h1, h2, bold italic etc as ckeeditor provided but once published no style shown in output/front end and when go back to the backend editor the style change itself no style existing. Please find the image attached. will you please provide the code which will help to solve the problem blog

    opened by careerhub-source 5
  • Installation

    Installation

    I installed this with a basic Laravel 7 setup. Ran the ui and your composer and then migrate etc. I also amended the User.php as instructed and ran the migration.

    I amended your config file to set User to \App\User.

    Logged in on my local machine by registering and of course I got to the "your are logged in".

    However when I then tried to run http://localhost:8000/blog_admin/setup I received a 401 unauthorized message,

    opened by jim1506 4
  • How to implement InvisibleRecaptcha

    How to implement InvisibleRecaptcha

    Hi,

    Can you tell me how I can implement an Invisible reCaptcha. I'm using this package https://github.com/albertcht/invisible-recaptcha and It will be nice to have the same captcha mechanism on the whole website.

    Thank you.

    opened by dan-pascu 4
  • Url Length Exceeded

    Url Length Exceeded

    You guys are using patch method while editing post. When you change the language the whole content of the post is coming with the url which can be problematic for server because we can not specify the length of the url. If the content of the blog will increase it will cause Url too long, length exceeded error. I would recommend instead of get use post method. Because I'm facing this issue on our live server. Thanks

    opened by usman-xs4arabia-dev 3
  • Database seeder uses MySQL injection

    Database seeder uses MySQL injection

    CreateLaravelFulltextTable-class contains direct DB::Connection injection which creates columns for text search which uses however MySQL specific column type. Of course this works only when used DB engine is actually MySQL and perhaps MariaSQL.

    However, before knew of this, I l already selected Postgresql so did have to commented out two lines that specific class before it went trough.

    And you should suggest npm commands anyway since if took code via composer it does not contains predefined web files.

    opened by hozmaster 3
  • Category Not Displayed Properly

    Category Not Displayed Properly

    Trying to get the categories for a post to display is not currently possible.

    If I dump out the categories I get this data blob: [{"id":2,"created_by":null,"parent_id":null,"lft":1,"rgt":2,"depth":0,"created_at":"2021-12-23T17:32:11.000000Z","updated_at":"2021-12-23T17:32:11.000000Z","pivot":{"post_id":1,"category_id":2}}]

    but if I try to iterate over, there is no relationship available to get the category name.

    The provided code in categories.blade.php also does not work:

        @foreach($post->categories as $category)
            <a class='btn btn-outline-secondary btn-sm m-1' href='{{$category->url()}}'>
                {{$category->category_name}}
            </a>
        @endforeach```
    opened by scs-ben 3
  • Lazy Loading issues across the package

    Lazy Loading issues across the package

    There are a number of lazy loading issues across the package that start to arise once I have added more than one post, you are calling model relationships within views which is not ideal, it should be called with a YourModel::with('relation')->get() before passing into the view. I know I could turn off lazy loading but that is not ideal for performance.

    An example is line 58 of your NinshopsAdmin Controller. looks like this: $posts = BinshopsPostTranslation::orderBy("post_id", "desc")->where('lang_id', $language_id) ->paginate(10);

    should be this:

    $posts = BinshopsPostTranslation::with(['post'])->orderBy("post_id", "desc")->where('lang_id', $language_id) ->paginate(10);

    as you are calling $post->post->name in the view, there are a number of other instances as well.

    Screenshot 2022-07-15 at 15 07 17 enhancement 
    opened by Preshiousy1 2
  • How to show english posts for all language codes & link without language code?

    How to show english posts for all language codes & link without language code?

    My website uses 3 languages. Default: www.domainname (calls the english version) English: www.domainname/en German: www.domainname/de French: www.domainname/fr

    I want my blog to display only english posts, no matter what language the user uses.

    I created German and French languages in the blog admin panel. Default: www.domainname/blog (404 error) English: www.domainname/en/blog German: www.domainname/de/blog French: www.domainname/fr/blog

    How can I always show english posts for all language codes and also for the link without a language code (www.domainname/blog)?

    open for contribution v9.3.x 
    opened by dappstatus 7
  • Can not Edit or update the multi lingual category as you are doing for multi lingual post

    Can not Edit or update the multi lingual category as you are doing for multi lingual post

    I can see there is an option to add multi lingual categories but while editing I'm only getting the single language category. Is there any way which I'm not getting or you guys are still working on it?

    new feature 
    opened by usman-xs4arabia-dev 1
  • viewSinglePost fails when a post is unpublished

    viewSinglePost fails when a post is unpublished

    When I unpublish a post and try to access it via url, the code breaks on $categories = $blogPost->post->categories()->with([ 'categoryTranslations' => function ($query) use ($request) { $query->where("lang_id", '=', $request->get("lang_id")); } ])->get(); because $blogPost->post is null. Would be nice if this was handled and an exception was thrown or a 404 page was returned.

    waiting for review 
    opened by bagdaddy 0
  • A few mistakes

    A few mistakes

    Hi, Version 9.2.x Laravel v8.78.1 (PHP v8.0.10)

    1. Post publish to PL:

    ErrorException Attempt to read property "slug" on null (View: \www\blog\vendor\binshops\laravel-blog\src\Views\binshopsblog_admin\posts\edit_post.blade.php) http://blog.test/blog_admin/edit_post/1

    1. Does not display posts and categories in PL on the list of all entries. - DASHBOARD
    2. It does not convert Polish characters in URLs - (ą => a, ć => c, etc.)
    3. Why can't you only make a Polish version? How do I remove the prefix /pl/ or /en/ from a URL?
    4. How to set an entry as: domain.test/name-title-post ?? (At least for the site's default version.)
    5. /blog_admin/add_post_toggle - The categories to be displayed are not showing.

    Will the single language version be developed?

    waiting for review 
    opened by anielka41 0
Releases(v9.3.0)
Owner
Binshops
Best In Shops | E-Commerce Solutions
Binshops
The easiest to use WordPress option framework.

Titan Framework The easiest to use WordPress options framework. Titan Framework allows theme and plugin developers to create admin pages, options, met

Gambit Technologies 374 Nov 14, 2022
An WPGraphQL extension that adds SearchWP's query functionality to the GraphQL server

QL Search What is QL Search? An extension that integrates SearchWP into WPGraphQL. Quick Install Install & activate SearchWP v3.1.9+ Install & activat

Funkhaus 11 May 5, 2022
Add WooCommerce support and functionality to your WPGraphQL server

WPGraphQL WooCommerce (WooGraphQL) Docs • AxisTaylor • Join Slack Quick Install Install & activate WooCommerce Install & activate WPGraphQL Download t

WPGraphQL 546 Jan 2, 2023
A simple little WordPress block that allows you add social share icons to your website.

Social Sharing Block This plugin requires WordPress 5.9+ or 5.8+ with Gutenberg active. A simple little block that allows you to add social share icon

Nick Diego 18 Dec 27, 2022
WordPress plugin that lets you use Discourse as the community engine for a WordPress blog

WP Discourse Note: the wp-discourse plugin requires >= PHP-5.4.0. The WP Discourse plugin acts as an interface between your WordPress site and your Di

Discourse 497 Dec 10, 2022
Adds a dashboard widget that allows admins to quickly open the edit screen for any WordPress post type- including orders, products, and subscriptions.

Quick Open Dashboard Widget Requires PHP: 7.0 WP requires at least: 5.7 WP tested up to: 5.7 WC requires at least: 5.6.0 WC tested up to: 5.8.0 Stable

Universal Yums 4 Nov 11, 2021
Simple Wordpress plugin that adds social share buttons

Super Fast Social Share Simple Wordpress plugin that adds social share buttons to Wordpress posts. ?? Screenshots You can either load the default css

Matthew Kiggen 2 Nov 8, 2021
Adds a beautiful WhatsApp Sticky Button on the WordPress frontend

Adds a beautiful WhatsApp Sticky Button on the WordPress frontend

Rasoul Mousavian 8 Dec 22, 2022
Adds WordPress toolbar menu that allows users to switch theme for themselves.

Toolbar Theme Switcher — for WordPress Plugin provides toolbar (admin bar) menu to quickly switch between available themes. Theme choice is individual

Andrey Savchenko 20 Jul 23, 2021
Add time dismissible admin notices to WordPress

WP Dismiss Notice Add time dismissible admin notices to WordPress. Fork of https://github.com/w3guy/persist-admin-notices-dismissal Instuctions Initia

Andy Fragen 6 Aug 24, 2022
A WordPress plugin that demonstrates how to easily add frontend interactivity with Alpinejs.

Add Alpinejs to Custom Gutenberg Blocks Is there a fun/easy/lightweight way to add frontend interactivity to custom Gutenberg blocks w/o using React o

null 9 Apr 20, 2022
A better way to create WordPress themes.

Runway Framework for WordPress Visit the Runway website: RunwayWP.com A better way to create WordPress themes. Runway was built for creating WordPress

Parallelus 214 Nov 18, 2022
Rabbit Framework - A modern way of building WordPress plugins

Rabbit Framework - A modern way of building WordPress plugins. About Rabbit Framework is a modern framework designed to be a solid foundation for your

VeronaLabs 8 Nov 20, 2022
A WordPress plugin to re-use the same domain name for both your website and your Rebrandly links

By installing this plugin and configuring it to connect with your Rebrandly account, you will be able to create branded links using the same domain yo

null 3 Jan 19, 2022
A curated list of Awesome WordPress Theme, Plugins and Framework development Resources and WordPress Communities.

Awesome WordPress A curated list of Awesome WordPress Theme, Plugins and Framework development Resources and WordPress Communities. Inspired by bayand

Dropndot Limited 91 Dec 26, 2022
A WordPress plugin to suspend WordPress sites automagically. Simple and lightweight, no annoying ads and fancy settings.

Suspend WP A WordPress plugin to suspend WordPress sites automagically. Simple and lightweight, no annoying ads and fancy settings. ?? Demo (coming so

Waren Gonzaga 3 Nov 15, 2021
The Pronamic WordPress Basecone plugin allows you to connect your WordPress installation to Basecone.

Pronamic WordPress Basecone The Pronamic WordPress Basecone plugin allows you to connect your WordPress installation to Basecone. Table of contents Au

Pronamic 1 Oct 19, 2021
Adds meta data registered via register_meta() to the GraphQL output.

WP GraphQL Meta This plugin is an add-on for the awesome WP GraphQL It builds on top of both WP GraphQL and the REST API. Any meta data you register u

Robert O'Rourke 18 Aug 4, 2021
WPGraphQL Extension: Adds "meta_query" support to postObject connection queries using WP_Query

WPGraphQL Meta Query This plugin adds Meta_Query support to the WP GraphQL Plugin for postObject query args. Why is this an extension and not part of

WPGraphQL 42 Nov 10, 2022