Merge pull request #16 from vicgonvt/master

Great work 👍, Thank you

Even though Travis CI tests are failing in the PR, they are passing in your fork.
This commit is contained in:
Jani Gyllenberg
2019-10-15 12:01:33 -04:00
committed by GitHub
3 changed files with 9 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
<p align="center"> <p align="center">
<a href="https://packagist.org/packages/distinctm/laravel-data-sync" target="_blank"><img src="https://poser.pugx.org/distinctm/laravel-data-sync/d/total.svg" alt="Total Downloads"></a> <a href="https://packagist.org/packages/distinctm/laravel-data-sync" target="_blank"><img src="https://poser.pugx.org/distinctm/laravel-data-sync/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/distinctm/laravel-data-sync" target="_blank"><img src="https://poser.pugx.org/distinctm/laravel-data-sync/v/stable.svg" alt="Latest Stable Version"></a> <a href="https://packagist.org/packages/distinctm/laravel-data-sync" target="_blank"><img src="https://poser.pugx.org/distinctm/laravel-data-sync/v/stable.svg" alt="Latest Stable Version"></a>
<a href="https://travis-ci.com/distinctm/laravel-data-sync"><img src="https://www.travis-ci.com/distinctm/laravel-data-sync.svg?branch=master" alt="Travis CI Build Status: Master"></a> <a href="https://travis-ci.com/distinctm/laravel-data-sync"><img src="https://api.travis-ci.com/nullthoughts/laravel-data-sync.svg?branch=master" alt="Travis CI Build Status: Master"></a>
</p> </p>
# Laravel Data Sync # Laravel Data Sync
@@ -36,8 +36,8 @@ If using Laravel Forge, you can have the data sync run automatically on deploy.
``` ```
if [ -f artisan ] if [ -f artisan ]
then then
php artisan data:sync
php artisan migrate --force php artisan migrate --force
php artisan data:sync
fi fi
``` ```

View File

@@ -8,6 +8,7 @@ use distinctm\LaravelDataSync\Exceptions\NoCriteriaException;
use distinctm\LaravelDataSync\Exceptions\NoRecordsInvalidJSONException; use distinctm\LaravelDataSync\Exceptions\NoRecordsInvalidJSONException;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
use stdClass; use stdClass;
class Updater class Updater
@@ -134,7 +135,7 @@ class Updater
$filename = pathinfo($file, PATHINFO_FILENAME); $filename = pathinfo($file, PATHINFO_FILENAME);
$order = array_search( $order = array_search(
studly_case($filename), Str::studly($filename),
config('data-sync.order') config('data-sync.order')
); );
@@ -197,7 +198,7 @@ class Updater
*/ */
protected function getModel(string $name) protected function getModel(string $name)
{ {
return '\\App\\'.studly_case(pathinfo($name, PATHINFO_FILENAME)); return '\\App\\'.Str::studly(pathinfo($name, PATHINFO_FILENAME));
} }
/** /**

View File

@@ -3,13 +3,14 @@
namespace distinctm\LaravelDataSync\Tests\Fakes; namespace distinctm\LaravelDataSync\Tests\Fakes;
use distinctm\LaravelDataSync\Updater; use distinctm\LaravelDataSync\Updater;
use Illuminate\Support\Str;
class UpdaterFake extends Updater class UpdaterFake extends Updater
{ {
protected function getModel(string $name) protected function getModel(string $name)
{ {
return '\\distinctm\\LaravelDataSync\\Tests\\'.studly_case( return '\\distinctm\\LaravelDataSync\\Tests\\'.Str::studly(
pathinfo($name, PATHINFO_FILENAME) pathinfo($name, PATHINFO_FILENAME)
); );
} }
} }