Coder Social home page Coder Social logo

laravel5-simple-cms's Introduction

Simple CMS for Laravel 5.*

This is a Laravel 5 package - https://github.com/glebstar/laravel5-simple-cms

GitHub Author

Installation

{
    "require": {
        "glebstar/laravel5-simple-cms": "dev-master"
    }
}

or run composer require glebstar/laravel5-simple-cms

Then run composer update in your terminal to pull it in.

Once this has finished, you will need to add the service provider to the providers array in your app.php config as follows:

GlebStarSimpleCms\ServiceProvider::class,

To publish a the package configuration file, run:

php artisan vendor:publish --provider="GlebStarSimpleCms\ServiceProvider"

Added routes for cms pages with your autorization middleware:

Route::group(['prefix' => 'cms', 'middleware' => 'cms'], function(){
    Route::get('/', ['as' => 'cms', 'uses' =>'\GlebStarSimpleCms\Controllers\AdminController@index']);
    Route::match(['get', 'post'], '/add', '\GlebStarSimpleCms\Controllers\AdminController@add');
    Route::match(['get', 'post'], '/edit/{id}', '\GlebStarSimpleCms\Controllers\AdminController@edit');
    Route::delete('/delete/{id}', '\GlebStarSimpleCms\Controllers\AdminController@delete');
});

// this route should be the last.
Route::get('{path}', '\GlebStarSimpleCms\Controllers\CmsController@index')->where('path', '([A-z\d-\/_.]+)?');

Apply migration

php artisan migrate

Configuration

Edit the file config/simplecms.php

Create a layout for cms pages, for example

@extends('layouts.main')

@section('add_title'){{$page->title}}@endsection
@section('description'){{$page->description}}@endsection
@section('keywords'){{$page->keywords}}@endsection

@section('content')
    <div class="container">
        @can('editor')
        <div>
            <a class="btn btn-info" href="{{ route('cms') }}/edit/{{ $page->id }}">Edit</a>
        </div>
        @endcan
        @yield('cmspagebody')
    </div>
@endsection

Your layout should have @yield('cmspagebody')

If you need, to edit package layouts in resources/views/vendor/simplecms

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.