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
{{-- You do not need to add this component if you are using the permanent option in the head component --}} | |
<script> | |
if (!window.sessionTimerPermanent && window.Livewire) { | |
window.livewire.hook('afterDomUpdate', startSessionTimer) | |
} | |
// if you are on livewire > 1.3.1 and want to avoid the default error alert | |
// https://github.com/livewire/livewire/pull/1146 | |
window.livewire.onError(statusCode => { | |
if (statusCode === 419) { |
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\Providers; | |
use App\Models\User; | |
use App\Observers\UserObserver; | |
use Illuminate\Support\ServiceProvider; | |
class AppServiceProvider extends ServiceProvider | |
{ |
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 you're into | |
- Laravel, https://laravel.com/ | |
- Filament https://filamentphp.com/ | |
- DTOs or Json columns. | |
Some templates... |
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
@push('body-styles') | |
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/trix/1.2.0/trix.css"> | |
@endpush | |
<form x-data="form()"> | |
<input x-ref="description" id="description" name="description" value='{{ $description }}' type="hidden" /> | |
<div wire:ignore> | |
<trix-editor input="description"></trix-editor> | |
</div> |
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 | |
/** | |
* OCR Number generation function | |
* | |
* @param string $base_number | |
* The base number that you wish to use for the OCR nr. Can be any number, | |
* but usually consists of client ID combined with invoice ID or similar. | |
* @param boolean $length | |
* Use length if you want the OCR number to add a length |
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
<div id="media-comp" class="display-contents"> | |
<media inline-template> | |
<form> | |
<div v-for="(image, index) in form" :key="index" @touchstart.stop @mousedown.stop class="col-span-6"> | |
<h3 class="text-3xl font-medium">@{{ image.label }}</h3> | |
<p class="py-3">Allowed Width @{{image.width}}px, Height @{{image.height}}px, Max file size @{{image.maxFileSize}}</p> | |
<input v-model="image.value" wire:model="@{{ image.name }}" type="hidden"> | |
<croppa v-model="image.model" :width="image.width" :height="image.height" | |
:placeholder="locale == 'sv' ? 'Välj en bild' : 'Choose an image'" | |
:accept="'image/*'" :file-size-limit="image.maxByte" :zoom-speed="3" :disable-drag-and-drop="false" |
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\Livewire\App\Organizers\Forms; | |
use App\Http\Livewire\Traits\Form; | |
use App\Models\Organizer; | |
use Livewire\Component; | |
class People extends Component | |
{ |
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; | |
trait HasLinks | |
{ | |
// $model->links = array | |
public function getLinksAttribute(): array | |
{ |
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
window.findHighestZ = () => [...document.querySelectorAll('body *')] | |
.map(elt => parseFloat(getComputedStyle(elt).zIndex)) | |
.reduce((z, highest=Number.MIN_SAFE_INTEGER) => | |
isNaN(z) || z < highest ? (isNaN(highest) ? 1 : highest) : z | |
) | |
//vanilla | |
document.getElementById("foo").style.zIndex = window.findHighestZ() |
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 App\Helpers\GeoHelper; | |
use Grimzy\LaravelMysqlSpatial\Types\Point; | |
trait AutoGeneratesPosition | |
{ |
NewerOlder