Get Started

Everything within the Laravel Bakery is easily managed within a configuration file. Each model is defined within this configuration. Configurations then cascade, where specified the specific HTTP Method / model combination will be used, then the specified model, then global overall, example below. Where possible full control has been handed over to configuration, so that the Bakery can work exactly how you want.

Example Configuration Cascade

The following is an example of the configuration cascade, however this example does not include the security policies.

// First try to find
bakery.models.users.post.security.gate

// If the above cannot be found
bakery.models.users.security.gate

// If the above cannot be found
bakery.security.gate

System Requirements

  • Laravel 7+

  • Compatible version of Eloquent ORM

Installation

  1. This package is installed using Composer composer require jtclabs/laravel-bakery

  2. Publish the assets (configuration file)

Basic Configurations

In config/bakery.php you will find basic setup configurations, which are defined below. The default configurations may roughly suit your needs, but they should be checked.

All configurations within this documentation start with the bakery. prefix

Configuration

Description

Explanation

general.route.name_prefix

Prefix all route names generated by Bakery with this value

null or any appropriate string

general.route.slug_prefix

Prefix all routes with this slug

null or any appropriate string

general.security.allow_guests

As default should guests be allowed access to resources defined by Bakery

bool

general.security.gate

A generic gate to be used as a fall back for all Bakery resources

string

models

Array of the defined models

Last updated

Was this helpful?