Skip to content

Instantly share code, notes, and snippets.

View sebastiaanluca's full-sized avatar
👋

Sebastiaan Luca sebastiaanluca

👋
View GitHub Profile
<?php
declare(strict_types=1);
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
@sebastiaanluca
sebastiaanluca / LocalizedNotifiable.php
Created May 16, 2018 10:28
Example of a localized notification
<?php
declare(strict_types=1);
namespace App\Notifications;
use App\Helpers\RemembersLocale;
use Illuminate\Notifications\Notifiable;
trait LocalizedNotifiable
@sebastiaanluca
sebastiaanluca / after_activate_new_release.sh
Created June 1, 2018 11:50
Example of how to gracefully deploy a new release when using Envoyer. Optionally, you could just stop/resume only the Horizon daemons, but since we only have one Supervisor daemon, this works fine.
# After *Activate New Release*
cd {{ release }}
php artisan cache:clear
php artisan view:clear
php artisan purifier:clear
php artisan config:cache
php artisan route:cache

Usage

$user->scopeTo('tenant-42')->can('do-something');
$user->scopeToModel($tenant)->can('do-something');

If you're using the proxy object directly, you might also be able to scope global calls on the Bouncer class like canAny, etc. You should be able to either pass the Bouncer class instance, tweak, or extend the object to your liking.

{{--myRandomView.blade.php--}}
<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">--}}
<div>
{{--Variable attributes are to be assigned manually--}}
<a href="{{ $href }}">
{{ $slot }}
provider: virtualbox
memory: 8192
cpus: 4
name: project
hostname: local1.project.com.test
ip: 192.168.116.20
authorize: ~/.ssh/id_rsa.pub
keys:
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
[yY][eE][sS]|[yY])
true
;;
*)