Courses

Multi-Language Laravel 11: All You Need to Know

This package relies on a separate DB table to contain all of your localized model information. You will have to manually create this table and add the necessary columns. The package will then automatically handle the rest.

In other words, it requires more setup initially but provides a lot of flexibility.


Installation

In the full installation guide we can quickly spot that it's not too complicated to install this package:

Installing package via composer:

composer require astrotomic/laravel-translatable

Publishing the config file:

php artisan vendor:publish --tag=translatable

Adapting the configuration file to our case:

'locales' => [
'en',
'es',
],

This will set the base up for us to use.


Usage

After the initial setup, we have to adapt our Models to use the translation, which will require quite a bit of coding (but it's not too complicated).

Use this package, the biggest difference is in Migrations and Models:...

This lesson is only for Premium Members.
Want to access all lessons of this course?

You also get:

  • 68 courses (1188 lessons, 43 h 18 min total)
  • Premium tutorials
  • Access to repositories
  • Private Discord