Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
u01jmg3 committed Aug 31, 2019
1 parent b017a1c commit b9f6443
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion authorization.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Gates are Closures that determine if a user is authorized to perform a given act
});

Gate::define('update-post', function ($user, $post) {
return $user->id == $post->user_id;
return $user->id === $post->user_id;
});
}

Expand Down
2 changes: 1 addition & 1 deletion collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ The `diffAssoc` method compares the collection against another collection or a p
'color' => 'yellow',
'type' => 'fruit',
'remain' => 3,
'used' => 6
'used' => 6,
]);

$diff->all();
Expand Down
2 changes: 1 addition & 1 deletion contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ First, let's review some code that is tightly coupled to a cache implementation.
*/
public function find($id)
{
if ($this->cache->has($id)) {
if ($this->cache->has($id)) {
//
}
}
Expand Down
2 changes: 1 addition & 1 deletion contributions.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Below is an example of a valid Laravel documentation block. Note that the `@para
* @param \Closure|string|null $concrete
* @param bool $shared
* @return void
*
*
* @throws \Exception
*/
public function bind($abstract, $concrete = null, $shared = false)
Expand Down
6 changes: 3 additions & 3 deletions database-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Laravel provides a variety of helpful tools to make it easier to test your datab
// Make call to application...

$this->assertDatabaseHas('users', [
'email' => '[email protected]'
'email' => '[email protected]',
]);
}

Expand Down Expand Up @@ -225,7 +225,7 @@ You may also attach relationships to models using Closure attributes in your fac
'content' => $faker->paragraph,
'user_id' => function () {
return factory(App\User::class)->create()->id;
}
},
];
});

Expand All @@ -240,7 +240,7 @@ These Closures also receive the evaluated attribute array of the factory that de
},
'user_type' => function (array $post) {
return App\User::find($post['user_id'])->type;
}
},
];
});

Expand Down
32 changes: 16 additions & 16 deletions eloquent-relationships.md
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ As demonstrated in the example above, you are free to add additional constraints
->orWhere('votes', '>=', 100)
->get();

// select * from posts
// select * from posts
// where user_id = ? and active = 1 or votes >= 100

In most situations, you likely intend to use [constraint groups](/docs/{{version}}/queries#parameter-grouping) to logically group the conditional checks between parentheses:
Expand All @@ -856,7 +856,7 @@ In most situations, you likely intend to use [constraint groups](/docs/{{version
})
->get();

// select * from posts
// select * from posts
// where user_id = ? and (active = 1 or votes >= 100)

<a name="relationship-methods-vs-dynamic-properties"></a>
Expand Down Expand Up @@ -936,38 +936,38 @@ To query the existence of `MorphTo` relationships, you may use the `whereHasMorp

// Retrieve comments associated to posts or videos with a title like foo%...
$comments = App\Comment::whereHasMorph(
'commentable',
['App\Post', 'App\Video'],
'commentable',
['App\Post', 'App\Video'],
function (Builder $query) {
$query->where('title', 'like', 'foo%');
}
)->get();

// Retrieve comments associated to posts with a title not like foo%...
$comments = App\Comment::whereDoesntHaveMorph(
'commentable',
'App\Post',
'commentable',
'App\Post',
function (Builder $query) {
$query->where('title', 'like', 'foo%');
}
)->get();
)->get();

You may use the `$type` parameter to add different constraints depending on the related model:

use Illuminate\Database\Eloquent\Builder;

$comments = App\Comment::whereHasMorph(
'commentable',
['App\Post', 'App\Video'],
'commentable',
['App\Post', 'App\Video'],
function (Builder $query, $type) {
$query->where('title', 'like', 'foo%');

if ($type === 'App\Post') {
$query->orWhere('content', 'like', 'foo%');
}
}
)->get();

Instead of passing an array of possible polymorphic models, you may provide `*` as a wildcard and let Laravel retrieve all the possible polymorphic types from the database. Laravel will execute an additional query in order to perform this operation:

use Illuminate\Database\Eloquent\Builder;
Expand Down Expand Up @@ -1006,7 +1006,7 @@ You may also alias the relationship count result, allowing multiple counts on th
'comments',
'comments as pending_comments_count' => function (Builder $query) {
$query->where('approved', false);
}
},
])->get();

echo $posts[0]->comments_count;
Expand Down Expand Up @@ -1148,7 +1148,7 @@ Sometimes you might want to always load some relationships when retrieving a mod
return $this->belongsTo('App\Author');
}
}

If you would like to remove an item from the `$with` property for a single query, you may use the `without` method:

$books = App\Book::without('author')->get();
Expand Down Expand Up @@ -1195,7 +1195,7 @@ To load a relationship only when it has not already been loaded, use the `loadMi

return [
'name' => $book->name,
'author' => $book->author->name
'author' => $book->author->name,
];
}

Expand Down Expand Up @@ -1380,7 +1380,7 @@ For convenience, `attach` and `detach` also accept arrays of IDs as input:

$user->roles()->attach([
1 => ['expires' => $expires],
2 => ['expires' => $expires]
2 => ['expires' => $expires],
]);

#### Syncing Associations
Expand Down
2 changes: 1 addition & 1 deletion eloquent-serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Occasionally, when casting models to an array or JSON, you may wish to add attri
*/
public function getIsAdminAttribute()
{
return $this->attributes['admin'] == 'yes';
return $this->attributes['admin'] === 'yes';
}
}

Expand Down
2 changes: 1 addition & 1 deletion encryption.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ You may encrypt a value using the `encrypt` helper. All encrypted values are enc
$user = User::findOrFail($id);

$user->fill([
'secret' => encrypt($request->secret)
'secret' => encrypt($request->secret),
])->save();
}
}
Expand Down
2 changes: 1 addition & 1 deletion homestead.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ Homestead includes the Postfix mail transfer agent, which is listening on port `
<a name="debugging-web-requests"></a>
### Debugging Web Requests With Xdebug

Homestead includes support for step debugging using [Xdebug](https://xdebug.org). For example, you can load a web page from a browser, and PHP will connect to your IDE to allow inspection and modification of the running code.
Homestead includes support for step debugging using [Xdebug](https://xdebug.org). For example, you can load a web page from a browser, and PHP will connect to your IDE to allow inspection and modification of the running code.

By default Xdebug is already running and ready to accept connections. If you need to enable Xdebug on the CLI run the `sudo phpenmod xdebug` command within your Vagrant box. Next, follow your IDE's instructions to enable debugging. Finally, configure your browser to trigger Xdebug with an extension or [bookmarklet](https://www.jetbrains.com/phpstorm/marklets/).

Expand Down
6 changes: 3 additions & 3 deletions queues.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Job middleware allow you wrap custom logic around the execution of queued jobs,
});
}

While this code is valid, the structure of the `handle` method becomes noisy since it is cluttered with Redis rate limiting logic. In addition, this rate limiting logic must be duplicated for any other jobs that we want to rate limit.
While this code is valid, the structure of the `handle` method becomes noisy since it is cluttered with Redis rate limiting logic. In addition, this rate limiting logic must be duplicated for any other jobs that we want to rate limit.

Instead of rate limiting in the handle method, we could define a job middleware that handles rate limiting. Laravel does not have a default location for job middleware, so you are welcome to place job middleware anywhere in your application. In this example, we will place the middleware in a `app/Jobs/Middleware` directory:

Expand Down Expand Up @@ -234,7 +234,7 @@ Instead of rate limiting in the handle method, we could define a job middleware
}
}

As you can see, like [route middleware](/docs/{{version}}/middleware), job middleware receive the job being processed and a callback that should be invoked to continue processing the job.
As you can see, like [route middleware](/docs/{{version}}/middleware), job middleware receive the job being processed and a callback that should be invoked to continue processing the job.

After creating job middleware, they may be attached to a job by returning them from the job's `middleware` method. This method does not exist on jobs scaffolded by the `make:job` Artisan command, so you will need to add it to your own job class definition:

Expand Down Expand Up @@ -425,7 +425,7 @@ You may chain the `onConnection` and `onQueue` methods to specify the connection
ProcessPodcast::dispatch($podcast)
->onConnection('sqs')
->onQueue('processing');

Alternatively, you may specify the `connection` as a property on the job class:

<?php
Expand Down
2 changes: 1 addition & 1 deletion releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ In addition, we can use new subquery features added to the query builder's `orde
->limit(1)
)->get();

### Laravel UI
### Laravel UI

The frontend scaffolding typically provided with previous releases of Laravel has been extracted into a `laravel/ui` Composer package. This allows the first-party UI scaffolding to be developed and versioned separately from the primary framework. As a result of this change, no Bootstrap or Vue code is present in default framework scaffolding, and the `make:auth` command has been extracted from the framework as well.

Expand Down

0 comments on commit b9f6443

Please sign in to comment.