Skip to content

Instantly share code, notes, and snippets.

View chrisbaswell's full-sized avatar

Chris Baswell chrisbaswell

View GitHub Profile
@chrisbaswell
chrisbaswell / gist:0d5b29d9b7a7679563d72442dea16285
Created November 7, 2021 17:03
Popper drop down blade component
@props([
'trigger' => ''
])
<div x-data="dropdown()" x-init="Popper.createPopper($el, $refs.popper, { placement: 'left', modifiers: [{name:'offset', options: {offset:[0,5]}}]});">
<div class="relative inline-block text-left">
<div x-spread="trigger">
@if($trigger)
{{ $trigger }}
@else
<button type="button" class="inline-flex items-center px-0 py-1 border border-transparent rounded-md shadow-sm text-gray-400 bg-gray-100 hover:bg-gray-200 focus:outline-none "
/**
* Die and dump on the Nth time this function is called
*/
if (! function_exists('dd_on')) {
function dd_on(int $number, ...$args): void
{
if (!isset($GLOBALS['dd'])) {
$GLOBALS['dd'] = 0;
}