qwildz / localized-eloquent-date
Multi-language support for Laravel Eloquent's dates
Installs: 14 296
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.4.0
- illuminate/support: 4.2.*|~5
- jenssegers/date: *
This package is auto-updated.
Last update: 2024-11-23 19:37:20 UTC
README
This library extends Eloquent for multi-language date support. Replace the use of Carbon in Eloquent to Laravel Date with PHP Trait. And this library support Ardent too.
Installation
Add the package to your composer.json
and run composer update
.
{
"require": {
"qwildz/localized-eloquent-date": "dev-master"
}
}
Add the Laravel Date service provider in app/config/app.php
:
'Jenssegers\Date\DateServiceProvider',
And if you need, you can add an alias to use Laravel Date package:
'Date' => 'Jenssegers\Date\Date',
Usage
Eloquent
If your model use pure Eloquent, just change your model class to extends Qwildz\LocalizedEloquentDate\LocalizedEloquent
clas.
use Qwildz\LocalizedEloquentDate\LocalizedEloquent as Model; class MyModel extends Model {}
Ardent
Or if you use Ardent, extends Qwildz\LocalizedEloquentDate\LocalizedArdent
class.
use Qwildz\LocalizedEloquentDate\LocalizedArdent as Model; class MyModel extends Model {}
Other
You still can use the library if you don't use both above with using Qwildz\LocalizedEloquentDate\LocalizedDateTrait
trait.
use Qwildz\LocalizedEloquentDate\LocalizedDateTrait; class MyModel extends Model { use LocalizedDateTrait; ... }