2017 © Pedro Peláez
 

library laravel-blog

laravel blog app

image

rnkpatel/laravel-blog

laravel blog app

  • Thursday, June 16, 2016
  • by rnkpatel
  • Repository
  • 1 Watchers
  • 0 Stars
  • 16 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 1 Versions
  • 100 % Grown

The README.md

laravel-blog

A simple Blog Module for Laravel 5, (*1)

Features

  • Create/update/delete posts.
  • Add different category of blog. Create blog in different category.
  • Bundled migration for building the database schema
  • Facebook API integration. Share/Like on Facebook.
  • Twitter API integration. Share on Twitter.
  • Google+ API integration. Share on Google+.
  • Infinite ajax scroller. No need to click on next page.
  • You can customise it as per your requirements.

Installation

  1. Create a file called module.php inside the config directory. Add following code in module.php., (*2)

    ```` return [ 'modules' => [ 'Blog', ] ]; ```, (*3)

    You can add more then one modules inside modules array., (*4)

  2. Open up the file config/app.php and add 'App\Modules\ModulesServiceProvider', to the end of the providers array., (*5)

    'providers' => [
        App\Modules\ModulesServiceProvider::class,
    ]
    
  3. Create new folder called Modules inside app directory., (*6)

  4. Add Blog folder inside Modules directory. App directory structure look like this:, (*7)

      app/
      |---Modules
          |---Blog
              |---Assets
              |---Components
              |---Controllers
              |---Middleware
              |---Migrations
              |---Models
              |---Views
              |---BlogServiceProvider.php
              |---routes.php
          |---ModulesServiceProvider.php
    
  5. Head to the Modules directory and add a file called ModulesServiceProvider.php, (*8)

  6. Run Migrations. For that use following command., (*9)

    $ php artisan migrate --path app/Modules/Blog/Migrations
    

    (Role column will be added into your users table. That will be define which user has author/admin role. You can change table name as per your requirement.), (*10)

  7. Add following methods into app/User.php, (*11)

    /**
     * user has many posts
     * @return type
     */
    public function posts()
    {
        return $this->hasMany('App\Modules\Blog\Models\Posts', 'author_id');
    }
    
    /**
     * user has many comments
     * @return type
     */
    public function comments()
    {
        return $this->hasMany('App\Modules\Blog\Models\Comments', 'from_user');
    }
    
    /**
     * Check if user can post blog
     * @return boolean
     */
    public function can_post()
    {
        $role = $this->role;
        if ($role == 'author' || $role == 'admin') {
            return true;
        }
        return false;
    }
    
    /**
     * Check if user is admin
     * @return boolean
     */
    public function is_admin()
    {
        $role = $this->role;
        if ($role == 'admin') {
            return true;
        }
        return false;
    }
    
  8. To set facebook API key open up Blog/Views/layouts/app.blade.php and set, (*12)

    appId      : 'your app id',
    

    in line number 8., (*13)

  9. To get twitter count register your domain on any APIs which providers twitter count. Open up Blog/Views/posts/show.blade.php and set Provided path to, (*14)

    data-via : 'Your domain path'
    

    in line number 187., (*15)

  10. For Routes you can add/update in Blog/routes.php (Blog module has its own routes.php so you can add/update routes here.), (*16)

  11. Please run composer dump-autoload, if you come across any Class not found exceptions and you haven’t done anything wrong, (*17)

Note:

This module is tested in fresh copy of laravel 5. If you have customised your application then please change as per your application., (*18)

Demo

http://plugins.auratechmind.net/laravel-blog/public/, (*19)

Discussion

http://auratechmind.net/question/category/laravel-blog/, (*20)

Credit

https://opensharecount.com/, (*21)

https://developers.facebook.com/, (*22)

http://www.findalltogether.com/tutorial/simple-blog-application-in-laravel-5/, (*23)

The Versions

16/06 2016

dev-master

9999999-dev

laravel blog app

  Sources   Download

GNU

by ronak