Skip to content

Laravel package that sets up a light flexible CMS with an admin control panel

License

Notifications You must be signed in to change notification settings

Bubalubs/gravity

Repository files navigation

Latest Stable Version License

Gravity is a Laravel package that sets up a light flexible CMS with an admin control panel

screenshot

Installation

Install using composer

composer require bubalubs/gravity

Create database tables by running migrations

php artisan migrate

Publish CSS/JS files for admin control panel

php artisan vendor:publish --tag=public

Add the HasRoles Trait to your User model

use Spatie\Permission\Traits\HasRoles;

class User extends Authenticatable
{
    use Notifiable, HasRoles;

    ...

To get going with basic auth, you can use Laravel Breeze

Usage

Using blade templating, you can output the CMS values.

To ouput global content use {{ $globalContent['field-name']}}

To show page content use {{ $content['field-name'] }}

Entities (Models)

Entities allow you to work with a custom Laravel model and adds CRUD options to the admin.

To work with images on an entity your model must implement the following interface and trait:

use Illuminate\Database\Eloquent\Model;
use Spatie\MediaLibrary\HasMedia\HasMedia;
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;

class YourModel extends Model implements HasMedia
{
    use HasMediaTrait;
    
    ...

Customizing Views

Publish view files to your laravel view directory then edit them to make changes

php artisan vendor:publish --provider=Bubalubs\Gravity\GravityServiceProvider

Updating

Update to the latest views (This will overwrite any changes you have made)

php artisan vendor:publish --provider=Bubalubs\Gravity\GravityServiceProvider --tag=public --force

Thanks

Thanks to spatie for their awesome libraries that this package relies on for permissions and media library!