Skip to content

Commit

Permalink
Add Lumen support.
Browse files Browse the repository at this point in the history
  • Loading branch information
brainlet-ali committed Oct 21, 2020
1 parent 7294f65 commit cddc64c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

All notable changes to `laravel-convert-timezone` will be documented in this file

## 1.0.1 - 2020-10-11

## 1.1.1 - 2020-10-21
- add Lumen support

## 1.0.1 - 2020-10-11
- move package related models into tests directory
## 1.0.0 - 2020-09-23

## 1.0.0 - 2020-09-23
- initial release
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,22 @@ A minimal package to convert any model's datetime fields from UTC to desired tim

## Installation

####Laravel
You can install the package via composer:

```bash
composer require brainlet-ali/laravel-convert-timezone
```

You can publish the config file with:
```bash
php artisan vendor:publish --provider="Brainlet\LaravelConvertTimezone\LaravelConvertTimezoneServiceProvider" --tag="config"
```
####Lumen
Add this into your service providers in bootstrap/app.php:
```bash
$app->register(Brainlet\LaravelConvertTimezone\LaravelConvertTimezoneServiceProvider::class);
```
Copy vendor/brainlet-ali/config/tz.php into your config directory


This is the contents of the published config file:

Expand Down
12 changes: 12 additions & 0 deletions src/Helpers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php


namespace Brainlet\LaravelConvertTimezone;

class Helpers
{
public static function isLaravel(): bool
{
return class_exists('Illuminate\Foundation\Application');
}
}
2 changes: 1 addition & 1 deletion src/LaravelConvertTimezoneServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class LaravelConvertTimezoneServiceProvider extends ServiceProvider
{
public function boot()
{
if ($this->app->runningInConsole()) {
if (Helpers::isLaravel() && $this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../config/tz.php' => config_path('tz.php'),
], 'config');
Expand Down

0 comments on commit cddc64c

Please sign in to comment.