Skip to content

Instantly share code, notes, and snippets.

View DarkGhostHunter's full-sized avatar

Italo DarkGhostHunter

View GitHub Profile
@DarkGhostHunter
DarkGhostHunter / layout.blade.php
Created March 17, 2020 19:28
Main App Layout
<!doctype html>
<html lang="{{ config('app.locale') }}">
<head>
@include('web.layout.head')
</head>
<body>
<header>
@include('web.layout.header')
</header>
<main>
@DarkGhostHunter
DarkGhostHunter / Enumerate.php
Created March 13, 2020 20:33
A nice class that enumerates values
<?php
class Enumerate
{
/**
* Current state of the enumerated object.
*
* @var string
*/
protected $current;
@DarkGhostHunter
DarkGhostHunter / ShareAuthenticatedUser.php
Created January 14, 2020 15:38
Shares the Authenticated User in all views
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\Auth\Authenticatable;
class ShareAuthenticatedUser
{
@DarkGhostHunter
DarkGhostHunter / Transport.php
Last active November 11, 2022 05:26
An invokable class for route binding
<?php
namespace App\Http\Bindings;
class Transport
{
/**
* Resolve the route bind
*
* @param string $value
@DarkGhostHunter
DarkGhostHunter / AuthenticatedComposer.php
Created January 11, 2020 20:53
Adds the authenticated user globally to all views
<?php
namespace App\Http\View\Composers;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\View\View;
class AuthenticatedComposer
{
/**
@DarkGhostHunter
DarkGhostHunter / ManagerServiceProvider.php
Created January 10, 2020 23:56
Registration of a Single Manager using a Service Provider
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use App\Managers\Transport\TransportManager;
use App\Managers\Transport\TransportContract;
class TransportServiceProvider extends ServiceProvider
{
<?php
namespace App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;
trait HasToken
{
@DarkGhostHunter
DarkGhostHunter / ExampleController.php
Last active November 11, 2022 05:26
A controller using the CachesResponse trait
<?php
namespace App\Controllers;
use App\Podcast;
use App\Http\Helpers\CachesResponses;
use Illuminate\Http\Request;
use Podcast\PodcastAnalytics\PodcastAnalytics;
class PodcastController extends Controller
@DarkGhostHunter
DarkGhostHunter / preload.php
Last active July 18, 2023 18:14
Preloader script
<?php
/**
* This file is generated automatically by Preloader.
*
* This script uses Composer Autoload file and `require_once` to preload the files in this
* list. Add this file to your `php.ini` in `opcache.preload` to preload this list into
* PHP at startup. Additionally, this file also includes information about Opcache.
*
*
* Add (or update) this line in `php.ini`:
@DarkGhostHunter
DarkGhostHunter / preload.json
Last active November 28, 2019 04:14
Preload JSON for composer.json
{
"pre-compile": [
"my-script.php",
"my-other-script.php"
],
"extensions": [
"php"
],
"files": [
"app/*",