Home

Awesome

Amila Laravel CMS

image Laravel CMS image Latest Stable Version

How to install for an existing Laravel project

// Make sure you already have laravel installed and configured the database in the .env
// Go to your laravel project folder and install it via composer
// Initialize the CMS (You can set up database table prefix and locale here)

composer require alexstack/laravel-cms && php artisan laravelcms


// Now you can access the cms frontend site: http://yourdomain/cms-home

// Access the backend with the FIRST USER of your site: http://yourdomain/cmsadmin

// Note: The default admin is the first user in your laravel database(user id = 1 )

How to set up a brand new CMS website with the latest Laravel

// Step 1: Install Laravel to folder cms
composer create-project laravel/laravel cms && cd cms && composer require alexstack/laravel-cms

// Step 2: install CMS in silent mode
php artisan laravelcms --locale=en --table_prefix=cms_ --silent=yes

// Note: it will ask for database settings if you did not change the default .env file
// Note: it will automatically run a web server on port 9321 for your project

// Step 3: Now, you can access your cms backend via http://127.0.0.1:9321/cmsadmin/
// Default admin username: admin@admin.com  password: admin321

How to uninstall

// Uninstall the CMS
php artisan laravelcms --action=uninstall

Demo & Documents

Screenshot of the output of install command

image

Screenshot of the output of uninstalling command

image

Screenshot of the admin panel

image image image

Set locale language to cn instead of en

cn_image

Error "Route [login] not defined" while access the backend /cmsadmin/

// Laravel 6.x & Laravel >= 7 & Laravel >= 8
composer require laravel/ui && php artisan ui vue --auth
// Laravel 5.x, run blow command instead
php artisan make:auth && php artisan migrate

How to log into the backend /cmsadmin/?

Why the uploaded image can not display (404 error)

Custom the cms route in config/laravel-cms.php

# Change homepage_route to /  in config/laravel-cms.php
'homepage_route'    => env('LARAVEL_CMS_HOMEPAGE_ROUTE', '/'),

# Remove the existing / route in the routes/web.php

// Route::get('/', function () {
//     return view('welcome');
// });
'page_route_prefix' => env('LARAVEL_CMS_PAGE_PREFIX', '/Article-'),
'admin_route'       => env('LARAVEL_CMS_BACKEND_ROUTE', '/admin2019'),
php artisan laravelcms --action=clear

Display an image with different size in the frontend Laravel .blade.php template file

@if ( isset($file_data->main_image) )
    <img src="{{$helper->imageUrl($file_data->main_image, '1000') }}" class="img-fluid" />

    <img src="{{$helper->imageUrl($file_data->main_image, '500') }}" class="img-fluid" />

    <img src="{{$helper->imageUrl($file_data->main_image, 'w', '150') }}" class="img-fluid" />

    <img src="{{$helper->imageUrl($file_data->main_image, '100', '100') }}" class="img-fluid" />

    <img src="{{$helper->imageUrl($file_data->main_image, 'original', 'original') }}" class="img-fluid" />

@endif

How to change the CSS & JS assets of the frontend?

<link rel="stylesheet" href="{{ $helper->assetUrl('css/main.css') }}">
...
<script src="{{ $helper->assetUrl('js/bottom.js') }}"></script>

How to set up a different template theme from the default?

    'template' => [
        'frontend_dir'      => 'frontend',
        'backend_dir'       => 'backend',
        'backend_language'  => 'en',
        'frontend_language' => 'en',
    ]

Set default slug format and suffix for page SEO URL in config/laravel-cms.php

    'slug_format'   => 'from_title',
    'slug_suffix'   => '.html',
    'slug_separate' => '-',

Use your own PHP class / How to integrate your PHP code into the CMS

How to upgrade the CMS?

composer require alexstack/laravel-cms && php artisan laravelcms --action=upgrade

image

ReactJS for backend All Pages list

What PHP versions do you support?

Laravel versions support

How to use PostgreSQL instead of MySql or MariaDB?

DB_CONNECTION=pgsql
DB_HOST=topsy.db.elephantsql.com
DB_PORT=5432
DB_DATABASE=oktetra
DB_USERNAME=oktetra
DB_PASSWORD=the-postgresql-password

How to store & access files on AWS s3?

How to install laravel/jetstream or other ui instead of laravel/ui?

// Step 1: Install Laravel to folder cms
composer create-project laravel/laravel cmsjet && cd cmsjet && composer require laravel/jetstream

// Step 2: install jetstream
php artisan jetstream:install inertia && npm install && npm run dev

// Step 3: install CMS in silent mode
composer require alexstack/laravel-cms && php artisan laravelcms --locale=en --table_prefix=jet_ --silent=yes

// Step 4: Edit routes/web.php
- Remove or comment Auth::routes();
- Change Route::get('/' to Route::get('/welcome'
- Run command: php artisan laravelcms --action=clear

// Step 5: Now, you can access your cms backend via http://127.0.0.1:9321/cmsadmin/
// Default admin username: admin@admin.com  password: admin321

How to install it on HeroKu?

License