2017 © Pedro Peláez
 

project base

Multilingual CMS built with Laravel 5

image

webfactorybulgaria/base

Multilingual CMS built with Laravel 5

  • Thursday, February 15, 2018
  • by webfactorybulgaria
  • Repository
  • 2 Watchers
  • 2 Stars
  • 281 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 171 Forks
  • 1 Open issues
  • 100 Versions
  • 3 % Grown

The README.md

Admintool4

Packagist Packagist SensioLabs Insight Scrutinizer, (*1)

Admintool4 is a modular multilingual content management system built with Laravel 5.2 based on TypiCMS. Out of the box you can manage pages, events, news, places, sliders, etc., (*2)

TypiCMS screenshot, (*3)

Table of contents

Features

URLs

This kind of URLs are managed by the CMS:, (*4)

Modules:, (*5)

  • /en/events/slug-in-english
  • /fr/evenements/slug-en-francais

Pages:, (*6)

  • /en/parent-pages-slug-en/subpage-slug-en/page-slug-en
  • /fr/parent-pages-slug-fr/subpage-slug-fr/page-slug-fr

Requirements

  • PHP >= 5.5.9
  • OpenSSL PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • Memcached or Redis

Installation

First install Node.js and gulp, (*7)

  1. Create a new project, (*8)

    composer create-project webfactorybulgaria/base mywebsite
    
  2. Enter the newly created folder, (*9)

    cd mywebsite
    
  3. DB migration and seed, user creation, npm installation and directory rights, (*10)

    php artisan admintool:install
    

Go to http://mywebsite.local/admin and log in., (*11)

npm & Gulp

In order to work on assets, you need to install Node.js and gulp, then cd to your website folder and run these commands:, (*12)

  1. Install gulp packages according to gulpfile.js (directory node_modules), (*13)

    npm install
    
  2. Compile admin and public assets, (*14)

    gulp all
    

Configuration

  1. Set locales in config/translatable.php.
  2. Set fallback_locale in config/app.php.
  3. Set main_locale_in_url in config/typicms.php to true or false.
  4. Cache driver is set to array, you can change it to another taggable cache system such as redis or memcached in your .env file.

Installation of a module

This example is for the News module. After these steps, the module will appear in the sidebar of the back office. If you need to customize it, publish it!, (*15)

  1. Install module with Composer, (*16)

    composer require webfactorybulgaria/news
    
  2. Add TypiCMS\Modules\News\Shells\Providers\ModuleProvider::class, to config/app.php, before TypiCMS\Modules\Core\Shells\Providers\ModuleProvider::class,
  3. Publish views and migrations, (*17)

    php artisan vendor:publish
    
  4. Migrate the database, (*18)

    php artisan migrate
    

Module scaffolding

This example is for a new module called Cats., (*19)

  1. Create the module with artisan:, (*20)

    php artisan admintool:create cats
    
  2. The module is in /Modules/Cats, you can customize it
  3. Add TypiCMS\Modules\Cats\Shells\Providers\ModuleProvider::class, to config/app.php, before TypiCMS\Modules\Core\Shells\Providers\ModuleProvider::class,
  4. Migrate the database, (*21)

    php artisan migrate
    

Existing modules

Each module can be published in order to be modified and tracked by git. Here is more info on publishing a module., (*22)

Pages

Pages are nestable with drag and drop, on drop, URIs are generated and saved in the database. Each translation of a page has its own route. A page can be linked to a module., (*23)

Each menu has nestable entries. One entry can be linked to a page or URL. You can return a HTML formated menu with Menus::build('menuname')., (*24)

Projects

Projects have categories, projects URLs follows this pattern: /en/projects/category-slug/project-slug, (*25)

Categories

Categories have many projects., (*26)

Tags

Tags are linked to projects and use the Selectize jQuery plugin. The tags module has many to many polymorphic relations so it could easily be linked to other modules., (*27)

Events

Events have starting and ending dates., (*28)

News

Simple news module with linked files/images galleries., (*29)

Contacts

Frontend contact form and admin side records management., (*30)

Partners

A partner has a logo, website URL, title and body content., (*31)

Files

The files module allows you to upload multiple files. It uses DropzoneJS to upload them. Thumbnails are generated on the fly with Croppa., (*32)

Galleries

You can create as many galleries as you want, each gallery has many files. Galleries are linkable to any module item through a polymorphic many to many relation., (*33)

Users and roles

User registration can be enabled through the settings panel (/admin/settings). Roles and Permissions are managed with spatie/laravel-permission., (*34)

Blocks

Blocks are useful to display custom content in your views. You can get the content of a block with Blocks::build('blockname')., (*35)

Translations

Translations can be stored in the database through the admin panel (/admin/translations)., (*36)

You can call DB translation everywhere with Lang::get('db.Key'), trans('db.Key') or @lang('db.Key')., (*37)

Sitemap

Route sitemap.xml generates a sitemap file in XML format. To add modules to the site map configure app/config/sitemap.php., (*38)

Settings

Change website title, and other options trough the settings panel. Settings are saved in the database, (*39)

History

created, updated, deleted, online and offline actions are logged in database. 25 latest records are displayed in the back office’s dashboard., (*40)

Facades

Each modules has a facade that give you access to the repository, you can call for example News::latest(3) to get the three latest news. Check available methods in each module’s repository., (*41)

Artisan commands

Commands are located in /vendor/admintool/core/src/Commands, (*42)

Installation of Admintool4

php artisan admintool:install

Set cache key prefix in app/config/cache.php

php artisan cache:prefix yourCachePrefix

This command is triggered by admintool:install, (*43)

Initial migration and seed

php artisan typicms:database

This command is triggered by admintool:install, (*44)

Clean the directory public/html

php artisan clear-html

Publish a module

If you want to modify a module, for example add some fields or a relation, you can not do it easily because each module is in vendor directory. Each TypiCMS class has its empty "Shell Class". This is an empty class which extends the base one and that is the one used in the entire CMS. When you publish a module all Shell classes are copied to the /Modules directory where you can easily override methods and properties. For example, the module Pages will be published by running this command:, (*45)

php artisan admintool:publish pages

This will copy everything from /vendor/typicms/pages/src/Shells to /Modules/Pages/Shells., (*46)

Then in order for these new classes to take precedence you will have to 1. Add this to your composer.json file: "TypiCMS\Modules\Pages\Shells\": "Modules/Pages/Shells/" 2. Run composer dump-autoload, (*47)

This way you will gain full controll of the module and in the same time you will be able to still update the module from the main repository if needed., (*48)

Create a module

You can easily scaffold a module, for a module named Cats, run this command:, (*49)

php artisan admintool:create cats

Upgrade instructions

See the Wiki for upgrade instructions, (*50)

Change log

Please see CHANGELOG for more information what has changed recently., (*51)

Contributing

Please see CONTRIBUTING for details., (*52)

Credits

License

Admintool4 is an open-source software licensed under the MIT license., (*53)

The Versions