Skip to content

Instantly share code, notes, and snippets.

View janyksteenbeek's full-sized avatar

Janyk Steenbeek janyksteenbeek

View GitHub Profile

Pulse — Filament v5 Theme

Quiet tooling. Clearer signals.

Admin panels do not have to feel loud, generic, or overbuilt. Pulse changes the tone of Filament.

With paper-warm surfaces, hairline dividers, a serif display face, mono labels, and one deliberate accent colour, Pulse brings the restraint of print design to the speed of a Filament panel.

Pulse — admin overview

@janyksteenbeek
janyksteenbeek / filament-action-confirm-delete-column-value.php
Created October 18, 2024 20:18
<Filament> Action: Confirm deletion by typing value of column
<?php
Tables\Actions\Action::make('delete')
->action(function ($record, array $data) {
if ($record->id != $data['confirm_id']) { // [edit column here]
Notification::make()
->title('Could not delete record')
->body('Sorry, but the text you entered does not match.')
->danger()
@janyksteenbeek
janyksteenbeek / filament-action-confirm-delete-password.php
Last active October 18, 2024 20:18
<Filament> Action: Confirm deletion with password
<?php
Tables\Actions\Action::make('delete')
->action(function ($record, array $data) {
if (!Hash::check($data['confirm_id'], auth()->user()->password)) {
Notification::make()
->title('Could not delete record')
->body('Sorry, but the password you entered was incorrect.')
->danger()
->send();
@janyksteenbeek
janyksteenbeek / filament-relationships-field.php
Created September 17, 2024 19:21
<Filament> Load options based on relation of other field
<?php
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('organiser_id')
->relationship('organiser', 'name')
->searchable()
->required()
@janyksteenbeek
janyksteenbeek / HasUnids.php
Created November 23, 2023 21:33
App\Traits\HasUnids (Unique Name Identifier) trait for Laravel: create an ID based on first names.
<?php
namespace App\Traits;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Str;
trait HasUnids
@janyksteenbeek
janyksteenbeek / cloudflare-shortener.js
Created August 3, 2023 14:41
Cloudflare Worker function for shortener
const redirects = [
{ path: 'privacy', redirect: 'https://cdn-static.storewire.net/legal/privacybeleid.pdf' },
{ path: 'tos', redirect: 'https://cdn-static.storewire.net/legal/leveringsvoorwaarden.pdf' },
{ path: 'ig', redirect: 'https://instagram.com/storewire' },
{ path: 'fb', redirect: 'https://facebook.com/storewire' },
{ path: 'gh', redirect: 'https://github.com/storewire' },
{ path: 'tw', redirect: 'https://twitter.com/storewirenl' },
{ path: 'li', redirect: 'https://linkedin.com/company/storewire' },
{ path: 'integration-bolcom-video', redirect: 'https://youtu.be/MTTp5x06bJI?t=30' }
];
@janyksteenbeek
janyksteenbeek / werkcentrumgroep-calculator-embed.html
Created June 27, 2023 18:19
WerkCentrum Groep Uitzendbureau calculator: Dit is de code waarmee je een calculator embed
<div class="wm-calculator" data-calculator-id="1764"></div>
<script src="https://www.werkcentrumgroep.nl/calculator.js">
</script>
<?php
return [
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
'AO' => 'Angola',
@janyksteenbeek
janyksteenbeek / laravel_cram_migration.php
Last active November 11, 2022 11:42
Laravel Cram Migration utility: This utility is used to cram a newly created Laravel migration file in between two migrations for correct order
<?php
/**
* Cram Migration utility
* ----------------------
*
* This utility is used to cram a newly created Laravel migration file in between two migrations for correct order.
* It is useful when you have a lot of migrations and you want to insert a new one in between.
*
* Make sure your new migration file is named correctly, starting with 9999, e.g. 9999_create_users_table.php
*
@janyksteenbeek
janyksteenbeek / tests.yaml
Last active November 11, 2022 11:44
GitHub Actions yaml file for running PHP tests (.github/workflows/tests.yaml)
# .github/workflows/tests.yml
name: Run Tests
on: [push, pull_request]
jobs:
Tests:
runs-on: ubuntu-18.04
strategy:
matrix:
php-versions: ['8.0', '8.1']
steps: