Skip to content

Commit c528573

Browse files
committed
Merge branch '4.2'
2 parents 1fd2456 + 08d578a commit c528573

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

billing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ Sometimes subscriptions are affected by "quantity". For example, your applicatio
121121
$user->subscription()->increment();
122122

123123
// Add five to the subscription's current quantity...
124-
$user->subscription()->increment(5)
124+
$user->subscription()->increment(5);
125125

126126
$user->subscription->decrement();
127127

128128
// Subtract five to the subscription's current quantity...
129-
$user->subscription()->decrement(5)
129+
$user->subscription()->decrement(5);
130130

131131
<a name="cancelling-a-subscription"></a>
132132
## Cancelling A Subscription

extending.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,19 @@ Let's take a look at the `UserProviderInterface`:
139139
interface UserProviderInterface {
140140

141141
public function retrieveById($identifier);
142+
public function retrieveByToken($identifier, $token);
143+
public function updateRememberToken(UserInterface $user, $token);
142144
public function retrieveByCredentials(array $credentials);
143145
public function validateCredentials(UserInterface $user, array $credentials);
144146

145147
}
146148

147149
The `retrieveById` function typically receives a numeric key representing the user, such as an auto-incrementing ID from a MySQL database. The `UserInterface` implementation matching the ID should be retrieved and returned by the method.
148150

151+
The `retrieveByToken` function retrieves a user by their unique `$identifier` and "remember me" `$token`, stored in a field `remember_token`. As with with previous method, the `UserInterface` implementation should be returned.
152+
153+
The `updateRememberToken` method updates the `$user` field `remember_token` with the new `$token`. The new token can be either a fresh token, assigned on successfull "remember me" login attempt, or a null when user is logged out.
154+
149155
The `retrieveByCredentials` method receives the array of credentials passed to the `Auth::attempt` method when attempting to sign into an application. The method should then "query" the underlying persistent storage for the user matching those credentials. Typically, this method will run a query with a "where" condition on `$credentials['username']`. **This method should not attempt to do any password validation or authentication.**
150156

151157
The `validateCredentials` method should compare the given `$user` with the `$credentials` to authenticate the user. For example, this method might compare the `$user->getAuthPassword()` string to a `Hash::make` of `$credentials['password']`.

queues.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,19 @@ As you can see, the `queue:work` command supports most of the same options avail
190190

191191
### Deploying With Daemon Queue Workers
192192

193-
The simplest way to deploy an application using daemon queue workers is to put the application in maintenance mode at the beginning of your deploymnet. This can be done using the `php artisan down` command. Once the application is in maintenance mode, Laravel will not accept any new jobs off of the queue, but will continue to process existing jobs. Once enough time has passed for all of your existing jobs to execute (usually no longer than 30-60 seconds), you may stop the worker and continue your deployment process.
193+
The simplest way to deploy an application using daemon queue workers is to put the application in maintenance mode at the beginning of your deploymnet. This can be done using the `php artisan down` command. Once the application is in maintenance mode, Laravel will not accept any new jobs off of the queue, but will continue to process existing jobs.
194194

195-
If you are using Supervisor or Laravel Forge, which utilizes Supervisor, you may typically stop a worker with a command like the following:
195+
The easiest way to restart your workers is to include the following command in your deployment script:
196196

197-
supervisorctl stop worker-1
197+
php artisan queue:restart
198198

199-
Once the queues have been drained and your fresh code has been deployed to your server, you should restart the daemon queue work. If you are using Supervisor, this can typically be done with a command like this:
199+
This command will instruct all queue workers to restart after they finish processing their current job.
200200

201-
supervisorctl start worker-1
201+
### Coding For Daemon Queue Workers
202+
203+
Daemon queue workers do not restart the framework before processing each job. Therefore, you should be careful to free any heavy resources before your job finishes. For example, if you are doing image manipulation with the GD library, you should free the memory with `imagedestroy` when you are done.
204+
205+
Similarly, your database connection may disconnect when being used by long-running daemon. You may use the `DB::reconnect` method to ensure you have a fresh connection.
202206

203207
<a name="push-queues"></a>
204208
## Push Queues

responses.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ The sub-view can then be rendered from the parent view:
133133
</body>
134134
</html>
135135

136+
#### Determining If A View Exists
137+
138+
If you need to check if a view exists, use the `View::exists` method:
139+
140+
if (View::exists('emails.customer'))
141+
{
142+
//
143+
}
144+
136145
<a name="view-composers"></a>
137146
## View Composers
138147

templates.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ If you don't want the data to be escaped, you may use double curly-braces:
129129
<p>This is user {{ $user->id }}</p>
130130
@endforeach
131131

132+
@forelse($users as $user)
133+
<li>{{ $user->name }}</li>
134+
@empty
135+
<p>No users</p>
136+
@endforelse
137+
132138
@while (true)
133139
<p>I'm looping forever.</p>
134140
@endwhile

0 commit comments

Comments
 (0)