coderstudios / cscms
Coder Studios CMS package
Requires
- php: ^7.3|^8.0
- illuminate/support: ^8.17|^9.0
Requires (Dev)
- mockery/mockery: ^1.0
- orchestra/testbench: ^6.0|^7.0
- phpunit/phpunit: ^9.0
- predis/predis: ^1.1
Suggests
- ext-redis: Required to use the Redis PHP driver.
- predis/predis: Required when not using the Redis PHP driver (^1.1).
README
CsCms is a CMS package in PHP for use with a Laravel project.
Composer
To install CsCms as a Composer package to be used with Laravel 5+, simply add this to your composer.json:
"coderstudios/cscms": "1.0.*"
..and run composer update
.
Edit App\Exceptions\Handler.php
..add the use statement
Illuminate\Auth\AuthenticationException;
and override the unauthenticated default function with the following
/** * Convert an authentication exception into a response. * * @param \Illuminate\Http\Request $request * @param \Illuminate\Auth\AuthenticationException $exception * @return \Illuminate\Http\Response */ protected function unauthenticated($request, AuthenticationException $exception) { $path = route('frontend.login'); if ($request->is('admin/*') || $request->is('admin')) { $path = route('backend.login'); } return $request->expectsJson() ? response()->json(['message' => $exception->getMessage()], 401) : redirect()->guest($path); }
Update auth.php replace providers array with config:
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => CoderStudios\CsCms\Models\User::class,
],
On a fresh install of laravel run:
- php artisan vendor:publish --provider="CoderStudios\CsCms\CsCmsServiceProvider"
- php artisan migrate
- php artisan cscms:install
If you are developing your own theme, ensure you add the view composer relevant to your theme in the AppServiceProvider.php boot method
view()->composer(config('CsCms.coderstudios.theme').'.layouts.master','CoderStudios\CsCms\Composers\Frontend\MasterComposer');
Documentation
Once the package is installed you can add
"@php artisan cscms:update"
to your composer.json so that on package update, any cached data or views get cleared automatically to account for any new package updates
Example update composer.json file
"@php artisan package:discover",
"@php artisan cscms:update"
Updating
#Assets
php artisan vendor:publish --provider="CoderStudios\CsCms\CsCmsServiceProvider"
php artisan vendor:publish --tag=public --force
php artisan vendor:publish --tag=resource --force
php artisan vendor:publish --tag=config --force
php artisan vendor:publish --tag=views --force
php artisan vendor:publish --tag=migrations --force
php artisan vendor:publish --tag=lang --force
Copyright and Licence
CsCms has been written by Coder Studios and is released under the MIT License.