@@ -7,11 +7,11 @@ |
||
7 | 7 | { |
8 | 8 | public function createApplication() |
9 | 9 | { |
10 | - $app = require __DIR__ . '/../vendor/laravel/laravel/bootstrap/app.php'; |
|
10 | + $app = require __DIR__.'/../vendor/laravel/laravel/bootstrap/app.php'; |
|
11 | 11 | $app->make(Kernel::class)->bootstrap(); |
12 | - $app->make(Factory::class)->load(__DIR__ . '/database/factories'); |
|
13 | - $app->afterResolving('migrator', function ($migrator) { |
|
14 | - $migrator->path(__DIR__ . '/database/migrations'); |
|
12 | + $app->make(Factory::class)->load(__DIR__.'/database/factories'); |
|
13 | + $app->afterResolving('migrator', function($migrator) { |
|
14 | + $migrator->path(__DIR__.'/database/migrations'); |
|
15 | 15 | }); |
16 | 16 | |
17 | 17 | return $app; |
@@ -7,7 +7,7 @@ |
||
7 | 7 | { |
8 | 8 | public function up() |
9 | 9 | { |
10 | - Schema::create('books', function (Blueprint $table) { |
|
10 | + Schema::create('books', function(Blueprint $table) { |
|
11 | 11 | $table->increments('id'); |
12 | 12 | $table->unsignedInteger('author_id'); |
13 | 13 | $table->timestamps(); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | { |
8 | 8 | public function up() |
9 | 9 | { |
10 | - Schema::create('authors', function (Blueprint $table) { |
|
10 | + Schema::create('authors', function(Blueprint $table) { |
|
11 | 11 | $table->increments('id'); |
12 | 12 | $table->timestamps(); |
13 | 13 |
@@ -3,7 +3,7 @@ |
||
3 | 3 | use Faker\Generator as Faker; |
4 | 4 | use GeneaLabs\LaravelModelCaching\Tests\Fixtures\Book; |
5 | 5 | |
6 | -$factory->define(Book::class, function (Faker $faker) { |
|
6 | +$factory->define(Book::class, function(Faker $faker) { |
|
7 | 7 | return [ |
8 | 8 | 'title' => $faker->title, |
9 | 9 | 'description' => $faker->paragraphs(3, true), |
@@ -3,7 +3,7 @@ |
||
3 | 3 | use Faker\Generator as Faker; |
4 | 4 | use GeneaLabs\LaravelModelCaching\Tests\Fixtures\Author; |
5 | 5 | |
6 | -$factory->define(Author::class, function (Faker $faker) { |
|
6 | +$factory->define(Author::class, function(Faker $faker) { |
|
7 | 7 | return [ |
8 | 8 | 'name' => $faker->name, |
9 | 9 | 'email' => $faker->unique()->safeEmail, |
@@ -34,7 +34,7 @@ |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | return cache()->tags([$parentName, $childName]) |
37 | - ->rememberForever("{$parentName}_{$parentIds}-{$childName}s", function () use ($relation) { |
|
37 | + ->rememberForever("{$parentName}_{$parentIds}-{$childName}s", function() use ($relation) { |
|
38 | 38 | return $relation->getEager(); |
39 | 39 | }); |
40 | 40 | } |
@@ -15,16 +15,16 @@ discard block |
||
15 | 15 | { |
16 | 16 | $relation = $this->$method(); |
17 | 17 | |
18 | - if (! $relation instanceof Relation) { |
|
18 | + if (!$relation instanceof Relation) { |
|
19 | 19 | throw new LogicException(get_class($this).'::'.$method.' must return a relationship instance.'); |
20 | 20 | } |
21 | 21 | |
22 | 22 | $results = $this->cache([$method]) |
23 | - ->rememberForever(str_slug(get_called_class()) . "-{$method}", function () use ($relation) { |
|
23 | + ->rememberForever(str_slug(get_called_class())."-{$method}", function() use ($relation) { |
|
24 | 24 | return $relation->getResults(); |
25 | 25 | }); |
26 | 26 | |
27 | - return tap($results, function ($results) use ($method) { |
|
27 | + return tap($results, function($results) use ($method) { |
|
28 | 28 | $this->setRelation($method, $results); |
29 | 29 | }); |
30 | 30 | } |
@@ -40,19 +40,19 @@ discard block |
||
40 | 40 | $class = get_called_class(); |
41 | 41 | $instance = new $class; |
42 | 42 | |
43 | - static::created(function () use ($instance) { |
|
43 | + static::created(function() use ($instance) { |
|
44 | 44 | $instance->flushCache(); |
45 | 45 | }); |
46 | 46 | |
47 | - static::deleted(function () use ($instance) { |
|
47 | + static::deleted(function() use ($instance) { |
|
48 | 48 | $instance->flushCache(); |
49 | 49 | }); |
50 | 50 | |
51 | - static::saved(function () use ($instance) { |
|
51 | + static::saved(function() use ($instance) { |
|
52 | 52 | $instance->flushCache(); |
53 | 53 | }); |
54 | 54 | |
55 | - static::updated(function () use ($instance) { |
|
55 | + static::updated(function() use ($instance) { |
|
56 | 56 | $instance->flushCache(); |
57 | 57 | }); |
58 | 58 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | factory(Author::class, 10)->create() |
20 | 20 | ->each(function($author) { |
21 | 21 | factory(Book::class, random_int(2, 10))->make() |
22 | - ->each(function ($book) use ($author) { |
|
22 | + ->each(function($book) use ($author) { |
|
23 | 23 | $book->author()->associate($author); |
24 | 24 | $book->save(); |
25 | 25 | }); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | $bookIds = (new Book)->all()->pluck('id'); |
32 | 32 | factory(Store::class, 10)->create() |
33 | - ->each(function ($store) use ($bookIds) { |
|
33 | + ->each(function($store) use ($bookIds) { |
|
34 | 34 | $store->books()->sync(rand($bookIds->min(), $bookIds->max())); |
35 | 35 | }); |
36 | 36 | cache()->flush(); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | { |
8 | 8 | public function up() |
9 | 9 | { |
10 | - Schema::create('book_store', function (Blueprint $table) { |
|
10 | + Schema::create('book_store', function(Blueprint $table) { |
|
11 | 11 | $table->increments('id'); |
12 | 12 | $table->unsignedInteger('book_id'); |
13 | 13 | $table->unsignedInteger('store_id'); |