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\Providers; | |
use Illuminate\Database\Connection; | |
use Illuminate\Database\Connectors\ConnectionFactory; | |
use Illuminate\Support\ServiceProvider; | |
use App\Database\CustomConnection; | |
class CustomDatabaseServiceProvider extends ServiceProvider |
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
\Illuminate\Support\Collection::macro('sortByList', function (iterable $orderList, ?string $property = null) { | |
return $this | |
->sortBy(function($item) use ($property, $orderList) { | |
$value = $item; | |
if (is_iterable($item)) { | |
$value = $item[$property]; | |
} | |
if (is_object($item)) { |
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 Livewire\Component; | |
class ProgressExample extends Component | |
{ | |
public function process() { | |
$progress = 0; | |
do { |
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\Http\Controllers; | |
use App\Models\PhpFunction; | |
use Intervention\Image\AbstractFont; | |
use Intervention\Image\Facades\Image; | |
class OgImageController | |
{ |
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 Illuminate\Foundation\Testing\Concerns; | |
use Illuminate\Console\OutputStyle; | |
use Illuminate\Contracts\Console\Kernel; | |
use Illuminate\Support\Arr; | |
use Illuminate\Testing\PendingCommand; | |
trait InteractsWithConsole |
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 | |
$input = file_get_contents('php://stdin'); | |
$headerPattern = '/• \[(.+)\] (.+): \((.+)\)/'; | |
$linePattern = '/ (.+):(\d+): (.+)/'; | |
$severity = 'error'; | |
$source = ''; | |
$message = ''; |
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
#!/bin/bash | |
# Prepend git commit messages | |
# | |
# Given we have a branch called 'feature/PHP-1337-awsome-stuff' | |
# every commit message will automatically be prepend with '[PHP-1337] ' | |
if [ -z "$BRANCHES_TO_SKIP" ]; then | |
BRANCHES_TO_SKIP=(master develop test) | |
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
<?php | |
/* | |
//Normal query | |
User::all(); | |
//Cached query (default 60min) | |
User::cached()->all(); | |
//Cached query (5min) |