This package contains various helper functions that you can use in your application. These are automatically loaded via Composer’s autoload mechanism.
// Get the current version of the package
manta_cms_version();
// Generate a URL to an asset in the package
manta_cms_asset('js/app.js');
// Get a value from the manta-cms configuration
manta_cms_config('key', 'default_value');
// Generate a URL to a route in the package
manta_cms_route('dashboard');
// Get the current logged-in user
manta_cms_user();
// Get the current logged-in staff user
manta_cms_staff();
// Other available helpers
cms_config('key');
module_config('module_name', 'key');
generatePassword($length = 12);
getLocaleManta();
getLocalesManta();
getRoutesManta();
word_wrap($text, $length = 75);
translate($key, $locale = null);
If you get an error message like Call to undefined function manta_cms_config()
, try the following:
composer dump-autoload
in your Laravel projectcomposer update
config/app.php
php artisan cache:clear
As a last resort, you can manually load the helpers by adding this line to your bootstrap/app.php
:
require_once __DIR__ . '/../vendor/manta/laravel-manta-cms/src/helpers.php';