New

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

flobbos/laravel-datable

A tiny Laravel package for easily switching localized dates
176 1
Install
composer require flobbos/laravel-datable
Latest Version:1.1.0
PHP:>=7.2.0
Laravel:6 – 9
Older releases:5
License:MIT
Last Updated:Mar 25, 2022
Links: GitHub  ·  Packagist
Maintainer: Flobbos

Laravel-Datable

Laravel Databale

For easy date localization

If you have trouble working with localized date formats used in combination with translations then this package might be for you. It simply provides a trait that you can add to your models which use https://github.com/jenssegers/date to provide localized date outputs.

Docs

Installation

Install the package
composer require flobbos/laravel-datable

That's it. Nothing else to do at this point.

Usage

Add it to the model

    namespace App;

    use Illuminate\Database\Eloquent\Model;
    use Flobbos\Datable;

    class Event extends Model {

        use Datable\Datable;

        protected $dates = [
            'starts_on',
            'ends_on'
        ];


    }

This is all you need to do to make it work. You won't notice a difference anywhere except when you're pulling formats like this:

    $your_model->starts_on->format('d. F Y');

The output will then have the localized month name instead of the default English.

Laravel compatibility

Laravel Crudable
5.6 >=0.4
5.5 >=0.4
5.4 >=0.4
5.3 >=0.4
5.2 >=0.1
5.1 >=0.1

Related Packages

masterro/laravel-chronos

Replace Carbon\Carbon with Cake\Chronos\Chronos

31 0
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
kirr665/localized-carbon

A localizable version of Carbon

84 0
qwildz/localized-eloquent-date

Multi-language support for Laravel Eloquent's dates

14,443 4

Version History

Version Released PHP Laravel License
1.1.0 >=7.2.0 >=6.0 MIT
1.0.0 >=7.2.0 >=6.0 MIT
0.4 >=5.6.0 >=5.3.0 MIT
0.3 >=5.6.0 5.3.* MIT
0.2 >=5.6.0 5.3.* MIT