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 / SqliteWalEnable.php
Created October 12, 2019 18:28
Enable WAL Journal in SQLite database
<?php
namespace App\Console\Commands\Sqlite;
use LogicException;
use Illuminate\Console\Command;
use Illuminate\Database\DatabaseManager;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\SQLiteConnection;
use Illuminate\Database\ConnectionInterface;
@DarkGhostHunter
DarkGhostHunter / AbstractDynamicModel.php
Last active November 11, 2022 05:27
Creates a new abstract model to share a dynamic connection
<?php
namespace App\DynamicModels;
use Illuminate\Eloquent\Model;
abstract class DynamicModel extends Model
{
/**
* Donnection data to inject into the config
@DarkGhostHunter
DarkGhostHunter / validation.md
Last active November 11, 2022 05:27
Laravel Validation methods order by purpose

Validation rules

This is a list of of Validation methods, ordered by purpose, instead of just alphabetical order.

This allows you to quickly find the methods for the data you want to validate, instead of checking the list one by one.


@DarkGhostHunter
DarkGhostHunter / collections.md
Last active December 19, 2023 08:23
Laravel Collection Methods order by Purpose

Collection methods

This is a list of Collection methods, ordered by purpose, instead of just an alphabetical order.

This allows you to quickly find the methods for the action you want to do, instead of checking the list one by one.


<?php
namespace App\Listeners;
use App\Ticket;
use App\Events\TicketSold;
use App\SerialProcessor\SerialProcessor;
use DarkGhostHunter\Laralock\HandlesSlot;
use DarkGhostHunter\Laralock\Contracts\Lockable;
use Illuminate\Bus\Queueable;
@DarkGhostHunter
DarkGhostHunter / 41e618e7caa7-CreateTicketListener.php
Last active August 10, 2019 18:17
Non concurrent Create Ticket Listener
<?php
namespace App\Listeners;
use App\Ticket;
use App\Events\TicketSold;
use Ticketer\TicketingApi;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use App\SerialProcessor\SerialProcessor;
@servers(['web' => ['[email protected]'] ]);
@setup
$current_dir = '/srv/www/project';
@endsetup
@story('deploy')
install
optimize
publish
<?php
class Car
{
protected $color = 'white';
protected Engine $engine;
public function __serialize()
{
<?php
namespace Illuminate\Foundation\Validation;
use Illuminate\Http\Request;
use Illuminate\Contracts\Validation\Factory;
use Illuminate\Validation\ValidationException;
trait ValidatesRequests
{
<?php
namespace Illuminate\Foundation\Bus;
use Illuminate\Contracts\Bus\Dispatcher;
trait DispatchesJobs
{
/**
* Dispatch a job to its appropriate handler.