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
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 | |
{ |
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 | |
return [ | |
'accepted' => 'Detta alternativ måste accepteras.', | |
'active_url' => 'Värdet är inte en giltig URL.', | |
'after' => 'Datumet måste vara efter :date.', | |
'after_or_equal' => 'Fältet måste vara ett datum efter :date eller lika med :date', | |
'alpha' => 'Fältet får bara innehålla bokstäver.', | |
'alpha_dash' => 'Fältet får bara innehålla bokstäver, nummer och bindestreck.', | |
'alpha_num' => 'Fältet får bara innehålla bokstäver och nummer.', |
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 | |
/** | |
* In your Livewire model for the list of items | |
*/ | |
class ItemList extends Component | |
{ | |
// rest of 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
{{-- 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
<script data-turbolinks-eval=false> | |
function updateToken() { | |
fetch('/update-csrf') | |
.then(response => response.text()) | |
.then(csrf => { | |
document.head.querySelector('meta[name="csrf-token"]').setAttribute('content', csrf) | |
}) | |
} | |
setInterval(updateToken, 1000 * 60 * 5) | |
</script> |
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 | |
$spaces = [ | |
'driver' => 's3', | |
'key' => env('DO_SPACES_KEY'), | |
'secret' => env('DO_SPACES_SECRET'), | |
'endpoint' => env('DO_SPACES_ENDPOINT'), | |
'region' => env('DO_SPACES_REGION'), | |
'bucket' => env('DO_SPACES_BUCKET') | |
]; |
NewerOlder