PHP code example of grafite / cms
1. Go to this page and download the library: Download grafite/cms library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
grafite / cms example snippets
php artisan grafite:cms-setup
'cms' => \App\Http\Middleware\GrafiteCms::class,
'cms-api' => \App\Http\Middleware\GrafiteCmsApi::class,
'cms-language' => \App\Http\Middleware\GrafiteCmsLanguage::class,
'cms-analytics' => \Grafite\Cms\Middleware\GrafiteCmsAnalytics::class,
Route::get('{url}', function ($url) {
return app(App\Http\Controllers\Cms\PagesController::class)->show($url);
})->where('url', '([A-z\d-\/_.]+)?');
auto-translate: false
$segments = request()->segments();
$supportedLanguages = array_keys(config('cms.languages'));
if (isset($segments[0]) && in_array($segments[0], $supportedLanguages)) {
$language = $segments[0];
unset($segments[0]);
return redirect(implode('/', $segments))->withCookie('language', encrypt($language))->send();
}
{!! $page->block('main') !!}
bash
php artisan vendor:publish --provider="Grafite\Cms\GrafiteCmsProvider"
bash
php artisan migrate
Gate::define('cms', function ($user) {
return ($user->roles->first()->name === 'admin');
});
php artisan theme:publish {name}
php artisan theme:link {name}
config('cms.modules.sample') // would retrieve the sample modules internal config.php contents
php artisan vendor:publish
php artisan module:publish
Publishes/database/migrations/migration_file.php