This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form x-data="{ name: '', age: null, coppa: false }"> | |
<h1 x-text="$wizard.title"></h1> | |
<div x-wizard:step> | |
This step can be completed without doing anything. It's | |
just informational. | |
</div> | |
<div |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Imagine you have a class that memoizes some data statically (let's assume | |
// the data is computationally expensive to load) | |
class ExpensiveDataHelper | |
{ | |
protected static $expensive_data = null; | |
public function getExpensiveData() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Tests\Project; | |
use RecursiveCallbackFilterIterator; | |
use RecursiveDirectoryIterator; | |
use RecursiveIteratorIterator; | |
use SplFileInfo; | |
use Tests\Constraints; | |
use Tests\TestCase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Support\Facades\Gate; | |
use RuntimeException; | |
/** | |
* @template M | |
*/ | |
trait HasRouteBoundModel | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<scheme name="Light - Minimal Color" version="142" parent_scheme="Default"> | |
<option name="FONT_SCALE" value="1.0" /> | |
<metaInfo> | |
<property name="created">2022-04-18T10:59:54</property> | |
<property name="ide">PhpStorm</property> | |
<property name="ideVersion">2022.1.0.0</property> | |
<property name="modified">2022-04-18T11:00:13</property> | |
<property name="originalScheme">Light - Minimal Color</property> | |
</metaInfo> | |
<console-font> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MonthlyPlan | |
{ | |
public int $length = 1; | |
public string $unit = 'month'; | |
public function normalizeBillingPeriod(Subscription $subscription, Carbon $charge_at): array | |
{ | |
// First, we'll naively compute the end of the billing period (assuming the timing is 100% accurate) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File 1: | |
REMOVE: LegacyRecord::each(function($record) { | |
ADD: LegacyRecord::with('new_record')->each(function($record) { | |
$identity = ['legacy_id' => $record->id]; | |
$values = $this->transformLegacyRecord($record); | |
REMOVE: NewRecord::updateOrCreate($identity, $values); | |
ADD: $new_record = $record->new_record ?? NewRecord::make($identity); | |
ADD: $new_record->fill($this->transformLegacyRecord($record)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Support; | |
use Closure; | |
use Illuminate\Support\Facades\App; | |
use Illuminate\Support\Str; | |
use Illuminate\Testing\Assert; | |
trait ShouldBeMocked |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root = true | |
[*] | |
charset = utf-8 | |
end_of_line = lf | |
insert_final_newline = true | |
indent_style = space | |
indent_size = 4 | |
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ArticleController | |
{ | |
public function show(Request $request, Article $article) | |
{ | |
// Set up a response and add last modified and/or ETag data | |
$response = response() | |
->setLastModified($article->updated_at) | |
->setEtag(md5($article->body), true); |