New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

qwildz/localized-eloquent-date

Multi-language support for Laravel Eloquent's dates
14,443 4
Install
composer require qwildz/localized-eloquent-date:dev-master
PHP:>=5.4.0
License:MIT
Last Updated:Feb 18, 2015
Links: GitHub  ·  Packagist
Maintainer: qwildz

Localized Eloquent Date

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;

    ...
}

Related Packages

flobbos/laravel-datable

A tiny Laravel package for easily switching localized dates

176 1
masterro/laravel-chronos

Replace Carbon\Carbon with Cake\Chronos\Chronos

31 0
ericlagarda/locally

Laravel 5 User Preferred Localization

21 1
c4uno/carbon-business

A manager to work business date that can use the database to add extra dates

4,071
20tries/date_range

An package for handling date ranges.

3,588 2