use Illuminate\Database\Query\Builder;
use Illuminate\Database\Query\Expression
Builder::macro('joinLateral', function ($query, $as, $type = 'inner') {
[$query, $bindings] = $this->createSub($query);
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 | |
| $roleIds = Role::whereIn('name', ['admin', 'moderator'])->pluck('id')->toArray(); | |
| // if pivot table relies on some additional value like in the example 'brand_slug' => 'some-slug' | |
| // we need to use syncWithPivotValues() where we're gonna update pivot records with 'brand_slug' values | |
| $user->brandRoles($brandSlug)->syncWithPivotValues( | |
| $roleIds, | |
| [ | |
| 'brand_slug' => $brandSlug |
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 PostRequestToApiTest extends TestCase { | |
| public function test_post_request_to_api(): void { | |
| $route = route('passport.token'); | |
| $formData = [ | |
| 'grant_type' => 'password', | |
| 'client_id' => 1, |
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
| @mixin remove-default-browser-outline { | |
| &, &:focus, &:active { | |
| outline: 0; /* this one is responsible for black border in Chrome */ | |
| -webkit-appearance: none; | |
| -webkit-tap-highlight-color: rgba(0,0,0,0); | |
| box-shadow: none; | |
| -moz-box-shadow: none; /* this one is responsible for glow in Chrome */ | |
| -webkit-box-shadow: none; | |
| text-shadow: none; |
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 Tests\Feature; | |
| use App\Helpers\SensitiveInputDataRemover; | |
| use Illuminate\Support\Facades\Log; | |
| use Tests\TestCase; | |
| class CheckSomethingTest extends TestCase | |
| { |
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 Tests\Feature; | |
| use Illuminate\Support\Facades\Log; | |
| use Tests\TestCase; | |
| class SomeTest extends TestCase | |
| { | |
| /** |
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
| #!/bin/bash | |
| # REQUIRES ROOT ACCESS TO DUMP ALL THE PROCEDURES TRIGGERS ETC. | |
| source .env | |
| DATE_TIME=$(date +%Y-%m-%d__%H_%M_%S) | |
| BACKUP_FILE="${DB_DATABASE}_backup_${DATE_TIME}.sql" | |
| docker exec project-mysql_database-1 mysqldump -h $DB_HOST -u root -p"$DB_ROOT_PASSWORD" $DB_DATABASE --single-transaction --routines --triggers > $BACKUP_FILE |
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
| #!/bin/bash | |
| DB_CONTAINER_NAME = 'mysql-container-1' | |
| DB_PASSWORD = 'secret' | |
| DB_NAME = 'db' | |
| DB_USER = 'db_user' | |
| DB_PORT = 3306 | |
| DB_HOST = 'db-host' | |
| docker exec -i $DB_CONTAINER_NAME mysql -h $DB_HOST -P $DB_PORT -u $DB_USER -p$DB_PASSWORD $DB_NAME < dump.sql |
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 App\Patches\LogManager; | |
| use Illuminate\Log\LogServiceProvider; | |
| use Illuminate\Support\Facades\Log; | |
| class CustomLogServiceProvider extends LogServiceProvider | |
| { |
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
| #!/bin/bash | |
| # provide directory of the repo | |
| cd $1; | |
| echo "------------- COMMITS ------------"; | |
| echo " "; | |
| git log --pretty=format:"%an" | sort | uniq -c | sort -nr | awk ' | |
| BEGIN { total_commits=0 } |