fbollon / lara-cms-lite
Content management system lite for Laravel app
Installs: 47
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Language:Blade
Requires
- php: ^7.1|^8.0|^8.1|^8.2
- illuminate/support: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- tinymce/tinymce: >= 5
Requires (Dev)
- orchestra/testbench: ^4.0
- phpunit/phpunit: ^8.0
README
Lara-cms-lite was created to allow some users to add and manage content on predefined business application pages in intranet, this avoids having to modify the application source code to change a text on a home page or other. We could also use this package to add a news-style page or blog to existing application.
Installation
Laravel from 6.x
to 11.x
are supported.
You can install the package via composer:
composer require fbollon/lara-cms-lite
Publish assets, config and views
- tinymce to public/vendor/tinymce
- lara-cms-lite config file and adjust values if needed in config/lara-cms-lite.php based on comments
- lara-cms-lite views to views/vendor/lara-cms-lite
php artisan vendor:publish --provider="Fbollon\LaraCmsLite\LaraCmsLiteServiceProvider"
Or publish by tags
php artisan vendor:publish --provider="Fbollon\LaraCmsLite\LaraCmsLiteServiceProvider" --tag=public php artisan vendor:publish --provider="Fbollon\LaraCmsLite\LaraCmsLiteServiceProvider" --tag=config php artisan vendor:publish --provider="Fbollon\LaraCmsLite\LaraCmsLiteServiceProvider" --tag=views
To force publishing add
--force
flag.
Create required tables
php artisan migrate
A table named 'contents' will be created, if a table with the same name already exists in your app change value of 'table' in config/lara-cms-lite.php
Authorization
Add 1 method canManageLaraCmsLiteContent() to your \App\User file with your own logic
Define a gate in your App\Providers\AuthServiceProvider
/** * Register any authentication / authorization services. * * @return void */ public function boot() { $this->registerPolicies(); Gate::define('lara-cms-lite-manage', function ($user) { return $user->canManageLaraCmsLiteContent(); }); }
Usage
Visit your application url : http://yourApplication/contents to start creating and managing content .
To display content in existing views of your application
In you default layout add this where you want to display content in your layout
@if (!empty($contents) && count($contents)) @include('lara-cms-lite::layouts.partials.contents') @endif
Depending where you allow users to add content in yours methods controller add
// import model use Fbollon\LaraCmsLite\Models\Content;
// for each method you allow to display content public function xxx() { // get content $contents = Content::getContextualContent(); // and send content to the view return view('xxx.xxx', compact('contents')); }
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
Credits
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.