PHP code example of fbollon / lara-cms-lite

1. Go to this page and download the library: Download fbollon/lara-cms-lite 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/ */

    

fbollon / lara-cms-lite example snippets


public function canManageLaraCmsLiteContent(): bool
{
    return true;
}

public function canManageLaraCmsLiteContent(): bool
{
    return $this->role === 'admin';
}

use Illuminate\Support\Facades\Gate;

Gate::define('lara-cms-lite-manage', function ($user) {
    return $user->canManageLaraCmsLiteContent();
});

use Fbollon\LaraCmsLite\Models\Content;

public function index()
{
    $contents = Content::getContextualContent();

    return view('your.view', compact('contents'));
}
bash
php artisan migrate
bash
php artisan vendor:publish --provider="Fbollon\LaraCmsLite\LaraCmsLiteServiceProvider" --tag=config
text
config/lara-cms-lite.php
bash
php artisan config:clear
bash
php artisan vendor:publish --provider="Fbollon\LaraCmsLite\LaraCmsLiteServiceProvider" --tag=views
bash
php artisan vendor:publish --provider="Fbollon\LaraCmsLite\LaraCmsLiteServiceProvider" --tag=views --force
bash
php artisan config:clear
bash
php artisan vendor:publish --provider="Fbollon\LaraCmsLite\LaraCmsLiteServiceProvider" --tag=views
bash
php artisan vendor:publish --provider="Fbollon\LaraCmsLite\LaraCmsLiteServiceProvider" --tag=views --force
bash
php artisan optimize:clear
php artisan migrate