cogroup/cms is a Laravel package for cms for all laravel projects.
It currently has 0 GitHub stars and 182 downloads on Packagist (latest version v3.0.7).
Install it with composer require cogroup/cms.
Discover more Laravel packages by cogroup
or browse all Laravel packages to compare alternatives.
Last updated
COgroup - CMS package is a flexible way to add basic CMS system with Role-based Permissions to Laravel.
composer require laravel/ui
php artisan ui bootstrap --auth
composer update:"cogroup/cms": "^2.0"
or run the next command:
composer require cogroup/cms "2.*"
Remove Auth::routes from web.php file
config/cogroupcms.php:php artisan vendor:publish --provider="Cogroup\Cms\CmsServiceProvider"
php artisan migrate
php artisan db:seed --class=CogroupCmsSeeder
php artisan cogroupcms:assets
php artisan cogroupcms:config
php artisan cogroupcms:errorviews
php artisan cogroupcms:fonts
php artisan cogroupcms:migrations
php artisan cogroupcms:seeders
php artisan cogroupcms:translations
config/auth.php file'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => Cogroup\Cms\Models\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
After you have installed Intervention Image, open your Laravel config file config/app.php and add the following lines.
In the $providers array add the service providers for this package.
Intervention\Image\ImageServiceProvider::class
Add the facade of this package to the $aliases array.
'ImageManager' => Intervention\Image\Facades\Image::class
Now the Image Class will be auto-loaded by Laravel.
$ php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravelRecent"
Set the property values in the config/cogroupcms.php.
These values will be used by cogroup-cms to refer to the correct prefix, color theme and URI to CMS access.
You may now run it with the artisan migrate command:
php artisan migrate
After the migration, seven new tables will be present:
files — manage files into CMSmodules — modules for CMSnoworkingdays — dates for special days, and to be able to discount in a range of datesroles — roles for CMSroles_access — relations between roles and modules accesssettings — CMS basic settings (sitename, emailname, etc.)user — Table for users and specific rol userThe Files model has eight main attributes:
originalname — Original name of the file.diskname — name of the file into system after upload.extension — extension of the file.size — size of the file.mimetype — Mime type of the file.alt — Texto for label alt in HTML.width — when is image, a width attribute.height — when is image, a height attribute.ispublic — determines whether a file is public or not.created_at — determines the creation date.updated_at — determine the update date.The Modules model has ten main attributes:
moduleslug — Slug name for the module, to verify permissions.modulename — Module name to show.description — A more detailed explanation of what the Module does.active — module is active or not.url — url to acces the module. The url should not have the domain.icon — font icon of the module.parent — When is a submodule, id of the parent module. When is a father module is 0.order — order to show module in the menu.inmenu — determines if the module is show in the main menu.permissions — Determine what permissions the module needs. They must be separated by commas. Example: "view, create".The NoWorkingDays model has two main attributes:
date — special day date.active — determines whether a date is active or not.created_at — determines the creation date.updated_at — determine the update date.The Role model has two main attributes:
rolname — Unique name for the Role, used for looking up role information in the application layer. For example: "admin", "owner", "employee".description — A more detailed explanation of what the Role does.created_at — determines the creation date.updated_at — determine the update date.The RolesAccess model has six main attributes:
roles_id — Unique key for the Role, used for relation to table roles.modules_id — Unique key for the modules, used for relation to table modules.view — Set the permission to see a module or submodule.create — Set the permission to create content in a module or submodule.update — Set the permission to update content in a module or submodule.delete — Set the permission to delete content in a module or submodule.created_at — determines the creation date.updated_at — determine the update date.The Settings model has two main attributes:
setting — Unique name for the setting.defaultvalue — A value for the setting attribute.This will enable the relation with Role.
And you are ready to go.
You can use a middleware to filter routes and route groups by permission or role
Route::group(['prefix' => 'settings', 'middleware' => ['admin:settings|view']], function() {
Route::get('/', 'AdminController@welcome');
Route::post('/', ['middleware' => ['admin:settings|create,update'], 'uses' => 'AdminController@manageAdmins']);
});
It is possible to use comma symbol to verify until two actions:
'middleware' => ['role:admin|create,update']
You can use a helper to verify a permission
cms_roles_check($check, $moduleslug, $type);
check is a Auth::user info or module id.moduleslug is a slug of the module to check permission.type is optional permission, by default it is view.Cogroup - CMS includes a two "helper" PHP functions. These functions are used by the package itself; however, you are free to use them in your own applications if you find them convenient.
This function return a modules of the system, register into table modules.
cms_get_modules($modulename, $inmenu, $idrol);
modulename is optional parameter. If is NULL return all modules.inmenu By default it is Y. The other option is N.idrol is optional parameter, by default it is NULL. When present, it returns the modules associated with the role that have permission viewThis function return a object with settings values
cms_settings();
Example: cms_settings()->sitename
This function return a Carbon format date with the dateformat setting format
cms_format_date($date);
date is required parameter. The date format must be Y-m-d.This function return a Carbon format date with the timeformat setting format
cms_format_time($time);
time is required parameter. The time format must be H:i:s.This function return a Carbon format date with the dateformat and timeformat setting format
cms_format_datetime($datetime);
datetime is required parameter. The date format must be Y-m-d H:i:s.This function return a attribute FileModel
cms_get_file_attribute($id, $attribute);
id is required parameter. Id into table Filesattribute is required parameter. Column of the table FilesThis function return a number of total unread notifications system
cms_get_file_attribute();
For change dashboard, change option dashboard into config/cogroupcms.php file.
Add all namespace example: \App\Http\Controllers\MyDashboardController
config channels into config/cogroupcms.php via option
'via' => ['mail', 'database'],
If use a mail channel add use Cogroup\Cms\Notifications\NewMessage; to your Controller.
For send message use Notification::send( $user, new NewMessage( $from, $message ) );
$user is the user to send email. Object User$from is the user from send email. Object User$message is a data messageThis configuration to set a float message from Controller
Set 0 to error, 1 to success, 2 to info, 3 to warning
$request->session()->flash('status', '1');
Set a position (top, bottom)
$request->session()->flash('msgfrom', {position});
Set a align (left, center, right)
$request->session()->flash('msgfrom', {align});
Set delay time (default: 4000)
$request->session()->flash('msgtime', {time});
Set a message
$request->session()->flash('msg', {message});
COgroup CMS is free software distributed under the terms of the MIT license.
Support follows PSR-4 PHP coding standards, and semantic versioning.
Please report any issue you find in the issues page. Pull requests are welcome.