Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
vfshera committed Nov 18, 2022
1 parent 3e884ac commit b7c2d0e
Show file tree
Hide file tree
Showing 32 changed files with 228 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## v1.6.1 - 2022-11-18

- docs update

## v1.6.0 - 2022-11-01

- docs update
Expand Down
3 changes: 2 additions & 1 deletion assets/docs/html/9.x/billing.html
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ <h4 id="incomplete-and-past-due-status">Incomplete and Past Due Status</h4>
Please confirm your payment.
<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
</code></pre>
<p>If you would like the subscription to still be considered active when it&#39;s in a <code>past_due</code> state, you may use the <code>keepPastDueSubscriptionsActive</code> method provided by Cashier. Typically, this method should be called in the <code>register</code> method of your <code>App\Providers\AppServiceProvider</code>:</p>
<p>If you would like the subscription to still be considered active when it&#39;s in a <code>past_due</code> or <code>incomplete</code> state, you may use the <code>keepPastDueSubscriptionsActive</code> and <code>keepIncompleteSubscriptionsActive</code> methods provided by Cashier. Typically, these methods should be called in the <code>register</code> method of your <code>App\Providers\AppServiceProvider</code>:</p>
<pre><code><span class="hljs-keyword">use</span> <span class="hljs-title">Laravel</span>\<span class="hljs-title">Cashier</span>\<span class="hljs-title">Cashier</span>;

<span class="hljs-comment">/**
Expand All @@ -733,6 +733,7 @@ <h4 id="incomplete-and-past-due-status">Incomplete and Past Due Status</h4>
<span class="hljs-keyword">public</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">register</span>(<span class="hljs-params"></span>)
</span>{
<span class="hljs-title class_">Cashier</span>::<span class="hljs-title function_ invoke__">keepPastDueSubscriptionsActive</span>();
<span class="hljs-title class_">Cashier</span>::<span class="hljs-title function_ invoke__">keepIncompleteSubscriptionsActive</span>();
}
</code></pre>
<blockquote>
Expand Down
15 changes: 15 additions & 0 deletions assets/docs/html/9.x/blade.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ <h1 id="blade-templates">Blade Templates</h1>
<li><a href="#stacks">Stacks</a></li>
<li><a href="#service-injection">Service Injection</a></li>
<li><a href="#rendering-inline-blade-templates">Rendering Inline Blade Templates</a></li>
<li><a href="#rendering-blade-fragments">Rendering Blade Fragments</a></li>
<li><a href="#extending-blade">Extending Blade</a><ul>
<li><a href="#custom-echo-handlers">Custom Echo Handlers</a></li>
<li><a href="#custom-if-statements">Custom If Statements</a></li>
Expand Down Expand Up @@ -1291,6 +1292,20 @@ <h2 id="rendering-inline-blade-templates">Rendering Inline Blade Templates</h2>
<span class="hljs-attr">deleteCachedView</span>: <span class="hljs-literal">true</span>
);
</code></pre>
<p><a name="rendering-blade-fragments"></a></p>
<h2 id="rendering-blade-fragments">Rendering Blade Fragments</h2>
<p>When using frontend frameworks such as <a href="https://turbo.hotwired.dev/">Turbo</a> and <a href="https://htmx.org/">htmx</a>, you may occasionally need to only return a portion of a Blade template within your HTTP response. Blade &quot;fragments&quot; allow you to do just that. To get started, place a portion of your Blade template within <code>@fragment</code> and <code>@endfragment</code> directives:</p>
<pre><code class="language-blade"><span class="hljs-template-tag">@fragment</span><span class="language-xml">(&#x27;user-list&#x27;)
<span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
</span><span class="hljs-template-tag">@foreach</span><span class="language-xml"> ($users as $user)
<span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span></span><span class="hljs-template-variable">{{</span><span class="language-php"> <span class="hljs-variable">$user</span>-&gt;name </span><span class="hljs-template-variable">}}</span><span class="language-xml"><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
</span><span class="hljs-template-tag">@endforeach</span><span class="language-xml">
<span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
</span><span class="hljs-template-tag">@endfragment</span>
</code></pre>
<p>Then, when rendering the view that utilizes this template, you may invoke the <code>fragment</code> method to specify that only the specified fragment should be included in the outgoing HTTP response:</p>
<pre><code class="language-php"><span class="hljs-keyword">return</span> <span class="hljs-title function_ invoke__">view</span>(<span class="hljs-string">&#x27;dashboard&#x27;</span>, [<span class="hljs-string">&#x27;users&#x27;</span> =&gt; <span class="hljs-variable">$users</span>])-&gt;<span class="hljs-title function_ invoke__">fragment</span>(<span class="hljs-string">&#x27;user-list&#x27;</span>);
</code></pre>
<p><a name="extending-blade"></a></p>
<h2 id="extending-blade">Extending Blade</h2>
<p>Blade allows you to define your own custom directives using the <code>directive</code> method. When the Blade compiler encounters the custom directive, it will call the provided callback with the expression that the directive contains.</p>
Expand Down
4 changes: 3 additions & 1 deletion assets/docs/html/9.x/container.html
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,13 @@ <h3 id="the-make-method">The <code>make</code> Method</h3>

<span class="hljs-variable">$transistor</span> = <span class="hljs-variable language_">$this</span>-&gt;app-&gt;<span class="hljs-title function_ invoke__">makeWith</span>(<span class="hljs-title class_">Transistor</span>::<span class="hljs-variable language_">class</span>, [<span class="hljs-string">&#x27;id&#x27;</span> =&gt; <span class="hljs-number">1</span>]);
</code></pre>
<p>If you are outside of a service provider in a location of your code that does not have access to the <code>$app</code> variable, you may use the <code>App</code> <a href="/docs/%7B%7Bversion%7D%7D/facades">facade</a> to resolve a class instance from the container:</p>
<p>If you are outside of a service provider in a location of your code that does not have access to the <code>$app</code> variable, you may use the <code>App</code> <a href="/docs/%7B%7Bversion%7D%7D/facades">facade</a> or the <code>app</code> <a href="/docs/%7B%7Bversion%7D%7D/helpers#method-app">helper</a> to resolve a class instance from the container:</p>
<pre><code><span class="hljs-keyword">use</span> <span class="hljs-title">App</span>\<span class="hljs-title">Services</span>\<span class="hljs-title">Transistor</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">Illuminate</span>\<span class="hljs-title">Support</span>\<span class="hljs-title">Facades</span>\<span class="hljs-title">App</span>;

<span class="hljs-variable">$transistor</span> = <span class="hljs-title class_">App</span>::<span class="hljs-title function_ invoke__">make</span>(<span class="hljs-title class_">Transistor</span>::<span class="hljs-variable language_">class</span>);

<span class="hljs-variable">$transistor</span> = <span class="hljs-title function_ invoke__">app</span>(<span class="hljs-title class_">Transistor</span>::<span class="hljs-variable language_">class</span>);
</code></pre>
<p>If you would like to have the Laravel container instance itself injected into a class that is being resolved by the container, you may type-hint the <code>Illuminate\Container\Container</code> class on your class&#39; constructor:</p>
<pre><code><span class="hljs-keyword">use</span> <span class="hljs-title">Illuminate</span>\<span class="hljs-title">Container</span>\<span class="hljs-title">Container</span>;
Expand Down
2 changes: 1 addition & 1 deletion assets/docs/html/9.x/eloquent.html
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ <h3 id="uuid--ulid-keys">UUID &amp; ULID Keys</h3>
<span class="hljs-keyword">return</span> [<span class="hljs-string">&#x27;id&#x27;</span>, <span class="hljs-string">&#x27;discount_code&#x27;</span>];
}
</code></pre>
<p>If you wish, you may choose to utilize &quot;ULIDs&quot; instead of UUIDs. ULIDs are similar to UUIDs; however, they are only 26 characters in length. Like ordered UUIDs, ULIDs are lexicographically sortable for efficient database indexing. To utilize ULIDs, you should use the <code>Illuminate\Database\Eloquent\Concerns\HasUlids</code> trait on your model:</p>
<p>If you wish, you may choose to utilize &quot;ULIDs&quot; instead of UUIDs. ULIDs are similar to UUIDs; however, they are only 26 characters in length. Like ordered UUIDs, ULIDs are lexicographically sortable for efficient database indexing. To utilize ULIDs, you should use the <code>Illuminate\Database\Eloquent\Concerns\HasUlids</code> trait on your model. You should also ensure that the model has a <a href="/docs/%7B%7Bversion%7D%7D/migrations#column-method-ulid">ULID equivalent primary key column</a>:</p>
<pre><code><span class="hljs-keyword">use</span> <span class="hljs-title">Illuminate</span>\<span class="hljs-title">Database</span>\<span class="hljs-title">Eloquent</span>\<span class="hljs-title">Concerns</span>\<span class="hljs-title">HasUlids</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">Illuminate</span>\<span class="hljs-title">Database</span>\<span class="hljs-title">Eloquent</span>\<span class="hljs-title">Model</span>;

Expand Down
10 changes: 8 additions & 2 deletions assets/docs/html/9.x/filesystem.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,20 @@ <h4 id="sftp-driver-configuration">SFTP Driver Configuration</h4>
</code></pre>
<p><a name="scoped-and-read-only-filesystems"></a></p>
<h3 id="scoped--read-only-filesystems">Scoped &amp; Read-Only Filesystems</h3>
<p>You may create a path scoped instance of any existing filesystem disk by defining a disk that utilizes the <code>scoped</code> driver. Scoped disks allow you to define a filesystem where all paths are automatically prefixed with a given path prefix. For example, you may create a disk which scopes your existing <code>s3</code> disk to a specific path prefix, and then every file operation using your scoped disk will utilize the specified prefix:</p>
<p>Scoped disks allow you to define a filesystem where all paths are automatically prefixed with a given path prefix. Before creating a scoped filesystem disk, you will need to install an additional Flysystem package via the Composer package manager:</p>
<pre><code class="language-shell">composer require league/flysystem-path-prefixing &quot;^3.0&quot;
</code></pre>
<p>You may create a path scoped instance of any existing filesystem disk by defining a disk that utilizes the <code>scoped</code> driver. For example, you may create a disk which scopes your existing <code>s3</code> disk to a specific path prefix, and then every file operation using your scoped disk will utilize the specified prefix:</p>
<pre><code class="language-php"><span class="hljs-string">&#x27;s3-videos&#x27;</span> =&gt; [
<span class="hljs-string">&#x27;driver&#x27;</span> =&gt; <span class="hljs-string">&#x27;scoped&#x27;</span>,
<span class="hljs-string">&#x27;disk&#x27;</span> =&gt; <span class="hljs-string">&#x27;s3&#x27;</span>,
<span class="hljs-string">&#x27;prefix&#x27;</span> =&gt; <span class="hljs-string">&#x27;path/to/videos&#x27;</span>,
],
</code></pre>
<p>If you would like to specify that any filesystem disk should be &quot;read-only&quot;, you may include the <code>read-only</code> configuration option in the disk&#39;s configuration array:</p>
<p>&quot;Read-only&quot; disks allow you to create filesystem disks that do not allow write operations. Before using the <code>read-only</code> configuration option, you will need to install an additional Flysystem package via the Composer package manager:</p>
<pre><code class="language-shell">composer require league/flysystem-read-only &quot;^3.0&quot;
</code></pre>
<p>Next, you may include the <code>read-only</code> configuration option in one or more of your disk&#39;s configuration arrays:</p>
<pre><code class="language-php"><span class="hljs-string">&#x27;s3-videos&#x27;</span> =&gt; [
<span class="hljs-string">&#x27;driver&#x27;</span> =&gt; <span class="hljs-string">&#x27;s3&#x27;</span>,
<span class="hljs-comment">// ...</span>
Expand Down
36 changes: 36 additions & 0 deletions assets/docs/html/9.x/helpers.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ <h1 id="helpers">Helpers</h1>
<li><a href="#available-methods">Available Methods</a></li>
<li><a href="#other-utilities">Other Utilities</a><ul>
<li><a href="#benchmarking">Benchmarking</a></li>
<li><a href="#lottery">Lottery</a></li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -3348,3 +3349,38 @@ <h3 id="benchmarking">Benchmarking</h3>
<p>To invoke a callback more than once, you may specify the number of iterations that the callback should be invoked as the second argument to the method. When executing a callback more than once, the <code>Benchmark</code> class will return the average amount of milliseconds it took to execute the callback across all iterations:</p>
<pre><code><span class="hljs-title class_">Benchmark</span>::<span class="hljs-title function_ invoke__">dd</span>(fn () =&gt; <span class="hljs-title class_">User</span>::<span class="hljs-title function_ invoke__">count</span>(), iterations: <span class="hljs-number">10</span>); <span class="hljs-comment">// 0.5 ms</span>
</code></pre>
<p><a name="lottery"></a></p>
<h3 id="lottery">Lottery</h3>
<p>Laravel&#39;s lottery class may be used to execute callbacks based on a set of given odds. This can be particularly useful when you only want to execute code for a percentage of your incoming requests:</p>
<pre><code><span class="hljs-keyword">use</span> <span class="hljs-title">Illuminate</span>\<span class="hljs-title">Support</span>\<span class="hljs-title">Lottery</span>;

<span class="hljs-title class_">Lottery</span>::<span class="hljs-title function_ invoke__">odds</span>(<span class="hljs-number">1</span>, <span class="hljs-number">20</span>)
-&gt;<span class="hljs-title function_ invoke__">winner</span>(fn () =&gt; <span class="hljs-variable">$user</span>-&gt;<span class="hljs-title function_ invoke__">won</span>())
-&gt;<span class="hljs-title function_ invoke__">loser</span>(fn () =&gt; <span class="hljs-variable">$user</span>-&gt;<span class="hljs-title function_ invoke__">lost</span>())
-&gt;<span class="hljs-title function_ invoke__">choose</span>();
</code></pre>
<p>You may combine Laravel&#39;s lottery class with other Laravel features. For example, you may wish to only report a small percentage of slow queries to your exception handler. And, since the lottery class is callable, we may pass an instance of the class into any method that accepts callables:</p>
<pre><code><span class="hljs-keyword">use</span> <span class="hljs-title">Carbon</span>\<span class="hljs-title">CarbonInterval</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">Illuminate</span>\<span class="hljs-title">Support</span>\<span class="hljs-title">Facades</span>\<span class="hljs-title">DB</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">Illuminate</span>\<span class="hljs-title">Support</span>\<span class="hljs-title">Lottery</span>;

DB::<span class="hljs-title function_ invoke__">whenQueryingForLongerThan</span>(
<span class="hljs-title class_">CarbonInterval</span>::<span class="hljs-title function_ invoke__">seconds</span>(<span class="hljs-number">2</span>),
<span class="hljs-title class_">Lottery</span>::<span class="hljs-title function_ invoke__">odds</span>(<span class="hljs-number">1</span>, <span class="hljs-number">100</span>)-&gt;<span class="hljs-title function_ invoke__">winner</span>(fn () =&gt; <span class="hljs-title function_ invoke__">report</span>(<span class="hljs-string">&#x27;Querying &gt; 2 seconds.&#x27;</span>)),
);
</code></pre>
<p><a name="testing-lotteries"></a></p>
<h4 id="testing-lotteries">Testing Lotteries</h4>
<p>Laravel provides some simple methods to allow you to easily test your application&#39;s lottery invocations:</p>
<pre><code><span class="hljs-comment">// Lottery will always win...</span>
<span class="hljs-title class_">Lottery</span>::<span class="hljs-title function_ invoke__">alwaysWin</span>();

<span class="hljs-comment">// Lottery will always lose...</span>
<span class="hljs-title class_">Lottery</span>::<span class="hljs-title function_ invoke__">alwaysLose</span>();

<span class="hljs-comment">// Lottery will win then lose, and finally return to normal behavior...</span>
<span class="hljs-title class_">Lottery</span>::<span class="hljs-title function_ invoke__">fix</span>([<span class="hljs-literal">true</span>, <span class="hljs-literal">false</span>]);

<span class="hljs-comment">// Lottery will return to normal behavior...</span>
<span class="hljs-title class_">Lottery</span>::<span class="hljs-title function_ invoke__">determineResultsNormally</span>();
</code></pre>
6 changes: 6 additions & 0 deletions assets/docs/html/9.x/http-tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ <h3 id="response-assertions">Response Assertions</h3>
<a href="#assert-plain-cookie">assertPlainCookie</a>
<a href="#assert-redirect">assertRedirect</a>
<a href="#assert-redirect-contains">assertRedirectContains</a>
<a href="#assert-redirect-to-route">assertRedirectToRoute</a>
<a href="#assert-redirect-to-signed-route">assertRedirectToSignedRoute</a>
<a href="#assert-see">assertSee</a>
<a href="#assert-see-in-order">assertSeeInOrder</a>
Expand Down Expand Up @@ -851,6 +852,11 @@ <h4 id="assertredirectcontains">assertRedirectContains</h4>
<p>Assert whether the response is redirecting to a URI that contains the given string:</p>
<pre><code><span class="hljs-variable">$response</span>-&gt;<span class="hljs-title function_ invoke__">assertRedirectContains</span>(<span class="hljs-variable">$string</span>);
</code></pre>
<p><a name="assert-redirect-to-route"></a></p>
<h4 id="assertredirecttoroute">assertRedirectToRoute</h4>
<p>Assert that the response is a redirect to the given <a href="/docs/%7B%7Bversion%7D%7D/routing#named-routes">named route</a>:</p>
<pre><code><span class="hljs-variable">$response</span>-&gt;<span class="hljs-title function_ invoke__">assertRedirectToRoute</span>(<span class="hljs-variable">$name</span> = <span class="hljs-literal">null</span>, <span class="hljs-variable">$parameters</span> = []);
</code></pre>
<p><a name="assert-redirect-to-signed-route"></a></p>
<h4 id="assertredirecttosignedroute">assertRedirectToSignedRoute</h4>
<p>Assert that the response is a redirect to the given <a href="/docs/%7B%7Bversion%7D%7D/urls#signed-urls">signed route</a>:</p>
Expand Down
1 change: 1 addition & 0 deletions assets/docs/html/9.x/middleware.html
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ <h3 id="sorting-middleware">Sorting Middleware</h3>
* <span class="hljs-doctag">@var</span> string[]
*/</span>
<span class="hljs-keyword">protected</span> <span class="hljs-variable">$middlewarePriority</span> = [
<span class="hljs-title class_">\Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests</span>::<span class="hljs-variable language_">class</span>,
<span class="hljs-title class_">\Illuminate\Cookie\Middleware\EncryptCookies</span>::<span class="hljs-variable language_">class</span>,
<span class="hljs-title class_">\Illuminate\Session\Middleware\StartSession</span>::<span class="hljs-variable language_">class</span>,
<span class="hljs-title class_">\Illuminate\View\Middleware\ShareErrorsFromSession</span>::<span class="hljs-variable language_">class</span>,
Expand Down
1 change: 1 addition & 0 deletions assets/docs/html/9.x/octane.html
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ <h2 id="concurrent-tasks">Concurrent Tasks</h2>
<p>Concurrent tasks processed by Octane utilize Swoole&#39;s &quot;task workers&quot;, and execute within an entirely different process than the incoming request. The amount of workers available to process concurrent tasks is determined by the <code>--task-workers</code> directive on the <code>octane:start</code> command:</p>
<pre><code class="language-shell">php artisan octane:start --workers=4 --task-workers=6
</code></pre>
<p>When invoking the <code>concurrently</code> method, you should not provide more than 1024 tasks due to limitations imposed by Swoole&#39;s task system.</p>
<p><a name="ticks-and-intervals"></a></p>
<h2 id="ticks--intervals">Ticks &amp; Intervals</h2>
<blockquote>
Expand Down
Loading

0 comments on commit b7c2d0e

Please sign in to comment.