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 | |
// Requires dependency: https://github.com/ralphjsmit/livewire-urls | |
if (!auth()->check()) { | |
$currentUrl = \RalphJSmit\Livewire\Urls\Facades\Url::current(); | |
Session::put('url.intended', $currentUrl); | |
$this->redirectRoute('login'); |
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
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> | |
<script> | |
const iconSvg = `<svg class="h-6 w-6 text-red-600" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true"> | |
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"></path> | |
</svg>`; | |
Swal.fire({ | |
showCancelButton: true, | |
buttonsStyling: false, |
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
device_mac_address=XX-XX-XX | |
is_connected=$(/opt/homebrew/bin/blueutil --is-connected $device_mac_address) | |
if [[ "$is_connected" == 1 ]]; then | |
/opt/homebrew/bin/blueutil --disconnect $device_mac_address | |
else | |
/opt/homebrew/bin/blueutil --connect $device_mac_address | |
fi |
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
<!-- Alpine Plugins --> | |
<script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/[email protected]/dist/cdn.min.js"></script> | |
<!-- Alpine Core --> | |
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script> | |
<div x-data="{ searchHistory: $persist([]).as('searchHistory') }" class="mx-auto max-w-sm bg-white py-8 px-6"> | |
<form | |
@submit=" | |
searchHistory.unshift($refs.searchInput.value) |
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\Jobs\Examples; | |
use App\Models\User; | |
use Carbon\Carbon; | |
use Illuminate\Bus\Queueable; | |
use Illuminate\Contracts\Queue\ShouldQueue; | |
use Illuminate\Foundation\Bus\Dispatchable; | |
use Illuminate\Queue\InteractsWithQueue; |
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 | |
// Livewire component | |
namespace App\Http\Livewire; | |
use App\Settings\GeneralSettings; | |
use Carbon\Carbon; | |
use Livewire\Component; |
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 | |
$source = Http::get('https://rickandmortyapi.com/api/character'); | |
$results = lazyJsonPages($source, 'results', static fn (Config $config): Config => $config | |
->items('info.count') | |
->perPage(20, 'page') | |
->concurrency(5) | |
); |
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 App\Models\Order; | |
use Illuminate\Database\Query\JoinClause; | |
use Illuminate\Support\Facades\DB; | |
use Staudenmeir\LaravelCte\Query\Builder; | |
$ordersData = Order::query() | |
->selectRaw("DATE_FORMAT(created_at, '%m/%Y') AS period, COUNT(*) AS orders_count") | |
->groupByRaw("DATE_FORMAT(created_at, '%m/%Y')"); |
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
{ | |
/** | |
* Better PHPUnit | |
**/ | |
//? Command in Sail like "sail test": | |
"better-phpunit.phpunitBinary": "test", | |
// "better-phpunit.phpunitBinary": "phpunit", | |
"better-phpunit.docker.enable": true, | |
"better-phpunit.docker.command": "./vendor/bin/sail", | |
"better-phpunit.docker.paths": { |