Welcome to the home of your new documentation
bootstrap/app.php
, you can setup route, global middlewares, redirects, expections, etc.
Usually you will not need to update anything unless you have specific global middlewares, api routes or other global settings.
AppServiceProvider.php
and delete or comment this line of code.
$guarded
instead, so this will not affect anything unless you start using $fillable
in Models)user
instead of App\Models\User
.
You can achieve this by enforcing morph map in AppServiceProvider.php
. Or you can remove to keep using long names.
$guarded
, instead of the default $fillable
property for mass assignment.
This prevents having bloated Models and allows seemless dynamic addition of new properties.
Instead, uses Form Requests to pass validated data on create or update of Eloquent Models, so it will never end up with bad data.
Here is an example of simple profile update using Form Request UpdateProfileRequest
. Only validated data from the request is being passed to the update()
method. This way we are in a total control of data so no need to explicitly define fillable properties.
/app/Policies
folder, while all the predefined Polices per module can be found under /modules/{name}/app/Policies
folder.
All the predefined core Form Requests can be found in /app/Http/Requests
folder, while all the predefined Form Requests per module can be found under /modules/{name}/app/Http/Requests
folder.
authorize
method which will allow or prevent further access, based on the rules.
Here you can use Policies or regular conditions.
This is the example from source code to check if users must be authenticated to create Roadmap posts.
rules
method which will define the validation rules.
You can define rules as string where validators are separated with pipe or as array of validators.
Here you can find the list of all available validators.
messages
method where you can customize validation messages. By default, validation messages will use lang/en/validation.php
translation file.
To define the message for your rules you should use this format rule_name.validator_name
SanitizesInput
trait. Then define filters()
method where you can define sanitizer rules per input field.
failedAuthorization
method where you can customize message for failed authorization. By default, validation messages will be “This action is unauthorized”.
usePage()
method or $page
variable. Read more about it here.
AdminLayout
only)HandleInertiaRequests.php
, under share
method to view and/or update your shared props.
There is also type PageProps
for shared props in /resources/js/types/index.d.ts
which you can update accordingly.
/resources/views/app.blade.php
using the blade rule @routes
, which uses the settings from this file /config/ziggy.php
. Feel free to update it by your project requirements.
By default, all routes are available except admin area routes, which are only available once the Admin has logged in.
Spatie\Sluggable\HasSlug
trait and the Spatie\Sluggable\SlugOptions
class on your Eloquent Model.
You should also add a field to Model’s table where generated slug will be saved.
config/media-library.php
.Spatie\MediaLibrary\HasMedia
interface and use the App\Traits\HasMediaUploads
trait on your Eloquent Model.
Then you should register your media collecions and conversions.cover
media for blog post with thumbnail
and small
image.
addMediaCollection
: Defines the collection name.useDisk
: Defines the disk name.singleFile
: There will always be just one file uploaded.registerMediaConversions
: Resized variants of original file. Read more in official docs.uploadImage
is defined in the trait HasMediaUploads
where you can check it’s definition.
It accepts four parameters:
UploadedFile|string $fileOrPath
: Uploaded image file or path to the image.string $mediaCollection
: Name of the media collection which you want to process. Defaults to cover
.string $diskName
: Storage disk name. Defaults to empty string and uses the disk defined with useDisk
chained method. You can set this parameter to override the default disk. You can use custom local storage or external storage. All disks are defined in config/filesystems.php
.bool $public = true
: File will be publicly visible when true. This is usually used when uploading files to remote disks.public
(/storage) and avatars
(/storage/avatars), and one external disk: s3
.
You can update those disks, delete them (if you delete them you will need to update the code using those disks) or create new local or external disks (MinIO, DigitalOcean Spaces, etc.).
public/storage
folder to the disk storage location. You can do this by running this terminal command:
APP_LOCALE
in .env
file to desired locale.
en.json
file and en
folder in /lang
, rename them to your new locale and adjust the translations.
app/Console/Commands/GenerateSitemap.php
Generate sitemap.xml
file for your application.
Sitemap command is triggered daily, which you can update here routes/console.php
.
13714
.
url
in config file config/inertia.php
and pass the port number as second prop to createServer
method in resources/js/ssr.ts
file.