Skip to content

Instantly share code, notes, and snippets.


Sebastiaan Luca sebastiaanluca

View GitHub Profile
sebastiaanluca / CarbonImmutableCaster.php
Last active Sep 20, 2021
Lazy Laravel Harvest API service
View CarbonImmutableCaster.php
namespace App\DataTransferObjects;
use Carbon\CarbonImmutable;
use Spatie\DataTransferObject\Caster;
class CarbonImmutableCaster implements Caster
View config.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
View config.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
sebastiaanluca / Controller.php
Last active May 31, 2021
A HasMany relation sync method implementation using macros
View Controller.php
$business->locations()->sync([1, 42, 16, 8]);
View Client.php
namespace Passport\Models;
use Closure;
use Laravel\Passport\Client as PassportClient;
use Ramsey\Uuid\Uuid;
View PreventsLazyLoading.php
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\Relations\HasOneThrough;
use Illuminate\Database\Eloquent\Relations\Relation;
View .bash_aliases
alias git-last-release='git describe --tags $(git rev-list --tags="[0-9]*.[0-9]*.[0-9]*" --max-count=1)'
confirm() {
# call with a prompt string or use a default
read -r -p "${1:-Are you sure? [y/N]} " response
case "$response" in
View Homestead.yaml
provider: virtualbox
memory: 8192
cpus: 4
name: project
authorize: ~/.ssh/
View activeLink-1.blade.php
View gist:f4b15e9f1a363108e60c748dc7111c3b
<active-link :href="route('my-route')" class="tag1 tag2 tag3" target="_blank">Much random</active-link>
{{--activeLink.blade.php option 1--}}
{{--Parent div inherits all unhandled attributes like class, target, … once rendered (so no work for the user)--}}
{{--<div class="tag1 tag2 tag3" target="_blank">--}}
{{--Variable attributes are to be assigned manually--}}
<a href="{{ $href }}">
{{ $slot }}