You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cache.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -141,7 +141,7 @@ The `Cache` facade's `get` method is used to retrieve items from the cache. If t
141
141
You may even pass a closure as the default value. The result of the closure will be returned if the specified item does not exist in the cache. Passing a closure allows you to defer the retrieval of default values from a database or other external service:
If you would like HTTP client to automatically retry the request if a client or server error occurs, you may use the `retry` method. The `retry` method accepts the maximum number of times the request should be attempted and the number of milliseconds that Laravel should wait in between attempts:
180
180
181
-
$response = Http::retry(3, 100)->post(...);
181
+
$response = Http::retry(3, 100)->post(/* ... */);
182
182
183
183
If needed, you may pass a third argument to the `retry` method. The third argument should be a callable that determines if the retries should actually be attempted. For example, you may wish to only retry the request if the initial request encounters an `ConnectionException`:
184
184
185
185
$response = Http::retry(3, 100, function ($exception, $request) {
186
186
return $exception instanceof ConnectionException;
187
-
})->post(...);
187
+
})->post(/* ... */);
188
188
189
189
If a request attempt fails, you may wish to make a change to the request before a new attempt is made. You can achieve this by modifying request argument provided to the callable you provided to the `retry` method. For example, you might want to retry the request with a new authorization token if the first attempt returned an authentication error:
190
190
@@ -196,11 +196,11 @@ If a request attempt fails, you may wish to make a change to the request before
196
196
$request->withToken($this->getNewToken());
197
197
198
198
return true;
199
-
})->post(...);
199
+
})->post(/* ... */);
200
200
201
201
If all of the requests fail, an instance of `Illuminate\Http\Client\RequestException` will be thrown. If you would like to disable this behavior, you may provide a `throw` argument with a value of `false`. When disabled, the last response received by the client will be returned after all retries have been attempted:
> {note} If all of the requests fail because of a connection issue, a `Illuminate\Http\Client\ConnectionException` will still be thrown even when the `throw` argument is set to `false`.
206
206
@@ -229,7 +229,7 @@ Unlike Guzzle's default behavior, Laravel's HTTP client wrapper does not throw e
229
229
230
230
If you have a response instance and would like to throw an instance of `Illuminate\Http\Client\RequestException` if the response status code indicates a client or server error, you may use the `throw` or `throwIf` methods:
231
231
232
-
$response = Http::post(...);
232
+
$response = Http::post(/* ... */);
233
233
234
234
// Throw an exception if a client or server error occurred...
235
235
$response->throw();
@@ -243,11 +243,11 @@ The `Illuminate\Http\Client\RequestException` instance has a public `$response`
243
243
244
244
The `throw` method returns the response instance if no error occurred, allowing you to chain other operations onto the `throw` method:
245
245
246
-
return Http::post(...)->throw()->json();
246
+
return Http::post(/* ... */)->throw()->json();
247
247
248
248
If you would like to perform some additional logic before the exception is thrown, you may pass a closure to the `throw` method. The exception will be thrown automatically after the closure is invoked, so you do not need to re-throw the exception from within the closure:
Copy file name to clipboardExpand all lines: queries.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -258,7 +258,7 @@ Instead of using the `DB::raw` method, you may also use the following methods to
258
258
<aname="selectraw"></a>
259
259
#### `selectRaw`
260
260
261
-
The `selectRaw` method can be used in place of `addSelect(DB::raw(...))`. This method accepts an optional array of bindings as its second argument:
261
+
The `selectRaw` method can be used in place of `addSelect(DB::raw(/* ... */))`. This method accepts an optional array of bindings as its second argument:
262
262
263
263
$orders = DB::table('orders')
264
264
->selectRaw('price * ? as price_with_tax', [1.0825])
@@ -348,7 +348,7 @@ You may also specify more advanced join clauses. To get started, pass a closure
0 commit comments