View PipelineFilter.php
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\Filters; | |
use Closure; | |
use Illuminate\Pipeline\Pipeline; | |
use Throwable; | |
class PipelineFilter extends Pipeline | |
{ |
View scopeBySaleType.php
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
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); | |
}); | |
} |
View helpers.php
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
if(! class_exists(\LodeApp\PHPUnit\Console::class)) { | |
function console($vars, $dump = true) { | |
dump($vars); | |
} | |
} |
View LockColumns.php
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\Traits; | |
trait LockColumns | |
{ | |
/** | |
* Cast locked_columns as a JSON column | |
* | |
* @return void |
View CorsHeaders.php
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\Middleware; | |
use Closure; | |
class CorsHeaders | |
{ | |
/** | |
* Handle an incoming request. |
View AdvancedAlgoliaEngine.php
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\Engines; | |
use Illuminate\Support\Collection; | |
use Laravel\Scout\Engines\AlgoliaEngine; | |
class AdvancedAlgoliaEngine extends AlgoliaEngine | |
{ |
View batchRename.php
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
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); |
View SimpleXMLExtended.php
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 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; |
View str_between.php
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
/** | |
* Get the portion of a string between two given strings. | |
* | |
* @param string $subject | |
* @param string $start | |
* @param string $end | |
* @param bool $insensitive | |
* @param bool $innerOnly | |
* @param bool $inverse | |
* |
View vueImplode.js
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
implode(array, key = null, glue = ', ') { | |
if(key) { | |
array = array.map(function(element) { | |
return element[key]; | |
}) | |
} | |
return array.join(glue); | |
}, |
NewerOlder