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
use Illuminate\Filesystem\Filesystem; | |
// 2 LINES OF MAGIC | |
$file = new Filesystem; | |
$file->cleanDirectory('storage/temp/'); |
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; | |
use Illuminate\Support\Facades\DB; | |
use Illuminate\Support\Str; | |
trait GenerateSafeUuidTrait | |
{ | |
public static function bootHasUuid() |
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
//AppServiceProvider.php | |
Storage::disk('local')->buildTemporaryUrlsUsing(function ($path, $expiration, $options) { | |
return URL::temporarySignedRoute( | |
'local.temp', | |
$expiration, | |
array_merge($options, ['path' => $path]) | |
); | |
}); | |
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 | |
# Source folder where your files are located | |
source_folder="/home/pappz/Downloads/metatest" | |
# Check if the source folder exists | |
if [ ! -d "$source_folder" ]; then | |
echo "Source folder does not exist: $source_folder" | |
exit 1 | |
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
# Remove DIRECTORY_NAME from all commits, then remove the refs to the old commits | |
# (repeat these two commands for as many directories that you want to remove) | |
git filter-branch --index-filter 'git rm -rf --cached --ignore-unmatch DIRECTORY_NAME/' --prune-empty --tag-name-filter cat -- --all | |
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d | |
# Ensure all old refs are fully removed | |
rm -Rf .git/logs .git/refs/original | |
# Perform a garbage collection to remove commits with no refs | |
git gc --prune=all --aggressive |
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 (! app()->environment('local')) { | |
\URL::forceScheme('https'); | |
} | |
if (! app()->environment('production')) { | |
Mail::alwaysTo('dev@email.address'); | |
} | |
Model::preventLazyLoading(! app()->isProduction()); |
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
$divided_by = 4; | |
$watermark_text = "watermark text"; | |
for ($i = 0; $i < $image_resize->getWidth(); $i = $i+($image_resize->getWidth()/$divided_by)) { | |
for ($j = 0; $j < $image_resize->getHeight(); $j = $j+($image_resize->getHeight()/$divided_by)) { | |
$image_resize->text($watermark_text, $i, $j, function ($font) use ($image_resize) { | |
$font->file(storage_path('fonts/DejaVuSans.ttf')); | |
$font->size(($image_resize->getHeight()/70)); | |
$font->color(array(0, 0, 0, 0.2)); | |
$font->align('center'); |
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 | |
public function paginate($items, $perPage = 15, $page = null, $options = []) | |
{ | |
$page = $page ?: (Paginator::resolveCurrentPage() ?: 1); | |
$items = $items instanceof Collection ? $items : Collection::make($items); | |
return new LengthAwarePaginator($items->forPage($page, $perPage), $items->count(), $perPage, $page, $options); | |
} |
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; | |
use Illuminate\Http\Request; | |
use Illuminate\Support\Facades\App; | |
class SetLanguage | |
{ |
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 | |
############### Infos - Edit them accordingly ######################## | |
DATE=`date +%Y-%m-%d_%H%M` | |
LOCAL_BACKUP_DIR="/home/username/path/to/db-backups" | |
#DB_NAME="$MYSQL_DATABASE" | |
#DB_USER="$MYSQL_USER" | |
#DB_PASSWORD="$MYSQL_PASSWORD" | |
FILE_NAME=db-$DATE.sql.gz |
NewerOlder