Skip to content

Commit

Permalink
Added flobbos/databale for localized dates.
Browse files Browse the repository at this point in the history
  • Loading branch information
Flobbo authored and Flobbo committed Dec 14, 2018
1 parent a5f5f9f commit c793294
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,54 @@
**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.
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](#installation)
* [Usage](#usage)
* [Laravel compatibility](#laravel-compatibility)

## Installation

#### Install the package

```bash
composer require flobbos/laravel-datable
```
That's it. Nothing else to do at this point.

## Usage

#### Add it to the model

```php

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:

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

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

0 comments on commit c793294

Please sign in to comment.