Skip to content

Instantly share code, notes, and snippets.

@Muetze42
Muetze42 / SetTimestampPrecisionCommand.php
Created December 6, 2025 09:38
SetTimestampPrecisionCommand
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'db:timestamp-precision')]
class SetTimestampPrecisionCommand extends Command
@Muetze42
Muetze42 / index.php
Last active May 2, 2025 10:00
PHP Benchmark
<?php
$start = hrtime(true);
$mem = memory_get_usage(true);
/**
* Your awesome code her...
*/
echo 'T: ' . number_format((hrtime(true) - $start) / 1_000_000, 2). " s\n";
@Muetze42
Muetze42 / laravel-events.md
Last active June 11, 2024 16:59
Laravel Events

Laravel 11.10

Auth

\Illuminate\Auth\Access\Events\GateEvaluated::class;
\Illuminate\Auth\Events\Attempting::class;
\Illuminate\Auth\Events\Authenticated::class;
\Illuminate\Auth\Events\CurrentDeviceLogout::class;
\Illuminate\Auth\Events\Failed::class;
module.exports = {
0.5: '0.125rem', // 2px
1: '0.25rem', // 4px
1.5: '0.375rem', // 6px
2: '0.5rem', // 8px
2.5: '0.625rem', // 10px
3: '0.75rem', // 12px
3.5: '0.875rem', // 14px
4: '1rem', // 16px
4.5: '1.125rem', // 18px
@Muetze42
Muetze42 / php-standards.md
Last active July 14, 2023 10:56
PHP Standards
@Muetze42
Muetze42 / README.md
Last active October 2, 2025 18:51
Laravel Eloquent Standalone

Using Laravel Eloquent (illuminate/database) standalone

Full Example with migrations

Install

Install package via composer

composer require illuminate/database
@Muetze42
Muetze42 / A-JsonResponse.php
Last active October 14, 2022 19:55
Laravel JsonResponse
<?php
namespace App\Common\Http;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Routing\ResponseFactory;
use Illuminate\Http\Response;
class JsonResponse extends \Symfony\Component\HttpFoundation\Response
{
@Muetze42
Muetze42 / snipped.php
Last active June 7, 2022 13:39
WooCommerce: Order as CSV and attach to emails
<?php
add_filter('woocommerce_email_attachments', function ($attachments, $emailId, $order) {
/* @var WC_Order $order */
$attachTo = [
'new_order',
'customer_on_hold_order',
'customer_processing_order',
'customer_completed_order',
'customer_refunded_order',
@Muetze42
Muetze42 / README.md
Created May 12, 2022 07:45
Nova 4: Add Font Awesome or other elements to the head element

Create if not exist resources/views/vendor/nova/partials/meta.blade.php

Add your elements in this file:

<!-- Font Awesome -->
<script src="https://kit.fontawesome.com/[YOUR-ID].js" crossorigin="anonymous"></script>