This file contains hidden or 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\Support\ServiceProvider; | |
use Laravel\Scout\Builder; | |
class MacroServiceProvider extends ServiceProvider | |
{ | |
/** |
This file contains hidden or 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; | |
class DuskServiceProvider extends ServiceProvider | |
{ | |
/** | |
* The classes that should be mocked for Dusk tests | |
* | |
* @var array |
This file contains hidden or 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\Filters; | |
use Closure; | |
use Illuminate\Pipeline\Pipeline; | |
use Throwable; | |
class PipelineFilter extends Pipeline | |
{ |
This file contains hidden or 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
public function scopeBySaleType($query, type) | |
{ | |
$query->whereHas('sales', function ($query) use ($type) { | |
$query->where('id', function ($sub) { | |
$sub->from('sales') | |
->selectRaw('max(id)') | |
->whereColumn('sales.inventory_id', 'inventories.id'); | |
})->where('type', $type); | |
}); | |
} |
This file contains hidden or 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
if(! class_exists(\LodeApp\PHPUnit\Console::class)) { | |
function console($vars, $dump = true) { | |
dump($vars); | |
} | |
} |
This file contains hidden or 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\Traits; | |
trait LockColumns | |
{ | |
/** | |
* Cast locked_columns as a JSON column | |
* | |
* @return void |
This file contains hidden or 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\Middleware; | |
use Closure; | |
class CorsHeaders | |
{ | |
/** | |
* Handle an incoming request. |
This file contains hidden or 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\Engines; | |
use Illuminate\Support\Collection; | |
use Laravel\Scout\Engines\AlgoliaEngine; | |
class AdvancedAlgoliaEngine extends AlgoliaEngine | |
{ |
This file contains hidden or 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
public static function testRename() | |
{ | |
self::batchRename('s3', 'documents', function ($file) { | |
return str_replace('%20', '-', $file); | |
}); | |
} | |
public static function batchRename($disk, $directory, $callback) | |
{ | |
$disk = \Illuminate\Support\Facades\Storage::disk($disk); |
This file contains hidden or 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 SimpleXMLExtended extends SimpleXMLElement | |
{ | |
// Inspired by: https://stackoverflow.com/questions/6260224/how-to-write-cdata-using-simplexmlelement/6260295 | |
public function addCDATA($string) | |
{ | |
$node = dom_import_simplexml($this); | |
$nodeOwner = $node->ownerDocument; |
NewerOlder