Skip to content

Instantly share code, notes, and snippets.

View DarkGhostHunter's full-sized avatar
👨‍💻
Hands full

Italo DarkGhostHunter

👨‍💻
Hands full
View GitHub Profile
@DarkGhostHunter
DarkGhostHunter / Seeder.php
Created January 22, 2024 19:40
Larawiz Seeder
<?php
namespace Database\Seeders;
use Closure;
use Illuminate\Console\View\Components\TwoColumnDetail;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Database\Query\Builder;
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
use Illuminate\Database\Eloquent\Factories\Factory;
@DarkGhostHunter
DarkGhostHunter / User.php
Last active March 4, 2024 17:16
Useful PHPDoc for your models (Copy & paste)
/**
* @mixin \Illuminate\Database\Eloquent\Builder
*
* @method \Illuminate\Database\Eloquent\Builder|static newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|static query()
* @method static \static make(array $attributes = [])
* @method static \static create(array $attributes = [])
* @method static \static forceCreate(array $attributes)
* @method static \static forceCreateQuietly(array $attributes = [])
* @method \static|null first($columns = ['*'], string ...$columns)
@DarkGhostHunter
DarkGhostHunter / .config.kernel
Created January 6, 2024 00:15
OpenWRT 23.05.2 - DL-WRX36 Kernel Config - First Try
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm64 5.15.137 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 13.1.0 r23630-842932a63d) 13.1.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=130100
CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=24000
@DarkGhostHunter
DarkGhostHunter / ExtendableScope.php
Last active March 17, 2023 09:29
An Eloquent Scope that extends the builder with private/protected methods.
<?php
namespace App\Scopes;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;
use Illuminate\Support\Collection;
use ReflectionClass
use SplFixedArray;
@DarkGhostHunter
DarkGhostHunter / InertiaController.php
Created July 7, 2022 06:38
Inertia Controller for slimming controller code
<?php
namespace App\Http\Controllers;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Str;
use Inertia\Inertia;
use function is_array;
use function ucfirst;
@DarkGhostHunter
DarkGhostHunter / TrixEditor.vue
Last active September 25, 2023 07:07
Using Trix (WYSIWYG editor) with Vue 3
<template>
<div class="trix-editor">
<textarea
:id="formId"
type="hidden"
ref="input"
:value="modelValue"
@input="$emit('update:modelValue', $event.target.value)"
style="display:none;"
><slot /></textarea>
@DarkGhostHunter
DarkGhostHunter / StaticPassword.php
Last active May 11, 2022 20:42
Password helper for Factories
<?php
namespace Database\Factories;
use Illuminate\Support\Facades\Hash;
trait StaticPassword
{
/**
* An 8-character password containing lower case, upper case, an special caracter and a number.
@DarkGhostHunter
DarkGhostHunter / composer.json
Last active March 21, 2024 18:10
Laragear Subscriptions Composer.json
{
"name": "laragear/subscriptions",
"description": "Subscriptions on-premises, without any payment system!",
"type": "library",
"license": "MIT",
"minimum-stability": "stable",
"prefer-stable": true,
"authors": [
{
"name": "Italo Baeza C.",
@DarkGhostHunter
DarkGhostHunter / ConfirmByPassword.php
Last active March 12, 2022 04:39
Confirms an action with a password
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Lang;
@DarkGhostHunter
DarkGhostHunter / log-levels.csv
Last active March 12, 2022 04:38
Log levels table
Property / Log Level Debug Info Notice Warning Error Critical Alert Emergency
Disposable X
Statistical X X X X X X X
Relevant X X X X X X
Undersired X X X X X
Unstable X X X X
Stateful X X X
Unsecure X X
Unfixable X