A Laravel based CMS inspired by Voyager.
Jasmine uses alexusmai/laravel-file-manager
If you are using it already or planing to,
you might need to tweak some configurations to prevent conflicts.
Require JasmineCMS in your new or existing laravel app
composer require jasminecms/jasmine
Link jasmine public assets to your public folder
php artisan jasmine:link-public-assets
Migrate the database (be sure to make any changes to the default laravel migration prior)
php artisan migrate
Create a user (1st user is super admin)
php artisan jasmine:create-user
Add Jasmine routes to your routes/web.php
routes file (you may change the prefix to anything you like)
Route::prefix('jasmine')->group(fn() => Jasmine::routes());
You can now log in to Jasmine,
Navigate to /jasmine
And login
You can register Jasmine assets in your AppServiceProvider
Jasmine supports multilingual assets, define your content languages like so
Jasmine::registerLocales(['en', 'he']);
Breadables can be any model
Run php artisan make:jasmine-model Post
to create a Jasmine Model
In your model implement
Jasmine\Jasmine\Bread\BreadableInterface
use trait Jasmine\Jasmine\Bread\Breadable
if the model has multilingual columns, also use trait
Jasmine\Jasmine\Bread\Translatable;
implement missing method
then register your model in AppServiceProvider
Jasmine::registerBreadable(\App\Models\MyModel::class);
Pages are very similar to models, but function as a single entity instead of a table
Run php artisan make:jasmine-model Post
to create a Jasmine Model
Register your pages in AppServiceProvider
Jasmine::registerPage(\App\Pages\Home::class);
You can translate Jasmine interface to any language like so
Jasmine::registerInterfaceLocale('he', 'path/to/locale.json');
the send parameter will accept either a path to your json file or an array of translations
you can copy /resources/front-lang/he.json
to get started quickly.
If for some reason you wish to load custom javascript or css you can do it like so
Jasmine::registerCustomStyle('/path/to/style.css');
Jasmine::registerCustomJs('/path/to/app.js');
TODO
You can add items to the sidebar menu like so
// internal
\Jasmine::registerSideBarMenuItem('settings', fn() => [
'title' => __('Settings'),
'icon' => 'bi-link-45deg text-danger',
'href' => route('jasmine.my.route', 'my-param-value'),
'is-route' => ['r' => 'jasmine.my.route', 'p' => ['my-param' => 'my-param-value']],
], 70);
// external
\Jasmine::registerSideBarMenuItem('site-triple', fn() => [
'href' => 'https://triple.co.il',
'title' => 'Triple',
'icon' => 'bi-link-45deg text-danger',
'target' => '_blank',
], 100);
TODO: registerSideBarSubMenuItem
You can register oauth2 providers to enable sso login to jasmine
Facebook example
Jasmine::registerOauth2Sso(
'Facebook', //name
'https://www.facebook.com/images/fb_icon_325x325.png', //icon
'{client_id}',
'{client_secret}',
'https://www.facebook.com/v3.3/dialog/oauth',
'https://graph.facebook.com/v3.3/oauth/access_token',
['email'],
false, // accepts boolean or callback
function ($token) {
$token = json_decode($token, true);
$res = Http::asJson()->get('https://graph.facebook.com/v3.3/me', [
'access_token' => $token['access_token'],
'fields' => 'name,email',
]);
return [
'name' => $res->json('name'),
'email' => $res->json('email'),
];
},
);