Skip to content

Instantly share code, notes, and snippets.

View browner12's full-sized avatar
💭
deleting all the code

Andrew Brown browner12

💭
deleting all the code
View GitHub Profile
@browner12
browner12 / autoCallback
Created November 15, 2014 01:22
Auto Callback for Relationship Collection
<?php
class Car extends Eloquent {
//wheels relationship
public function wheels(){
return $this->hasMany('Wheel');
}
//current hack
@browner12
browner12 / ideas.md
Last active September 22, 2020 17:35
Forge and Envoyer Ideas

Forge

  • Option when creating a new site to automatically make the Laravel schedule:run cron job.
  • Move a lot of the 'helper text' into tooltips. Less cluttered design, especially for experienced users, but still provides the info for those who need it.
  • Move all of the 'create' forms into modals (or separate pages). Brings our list of existing sites or servers above the fold. Again, lends towards a cleaner UX.
  • Similar to the Homestead aliases file, allow us to define and save alias files, that we can can include on the server when we build it.
  • Allow us to define and save different deploy scripts, that we can apply to sites. For example, save a custom one for 'production' deploys, and one for 'staging' deploys.
  • autocomplete="one-time-code" for 2FA token on login.
  • Deploy script variables. {{ sha }}
  • Add alias 'Sites'. A domain that points to another project folder. Essentially what this comes down to (I think) is allowing us to override the base part of the ng
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Str;
class MakeAll extends Command
{
/**
* The name and signature of the console command.
*
@browner12
browner12 / BeanstalkdQueue.php
Last active December 4, 2022 06:18
Queue Prefixing
/**
* Get the queue or return the default.
*
* @param string|null $queue
* @return string
*/
public function getQueue($queue)
{
$queue = $queue ?: $this->default;
@browner12
browner12 / memory.php
Created May 12, 2017 17:21
Gate Optimization
<?php
class StringClass
{
private $abilities = [];
public function __construct($count = 1)
{
for ($a = 1; $a <= $count; $a++) {
$this->abilities['key' . $a] = 'value' . $a;
@browner12
browner12 / Controller.php
Created June 28, 2017 03:09
Polymorphic Model Builder
class Controller
{
public function index(Request $request)
{
$taggable = model($request->get('taggable_type'), $request->get('taggable_id');
}
}
@browner12
browner12 / controller.php
Last active September 28, 2017 17:48
Reauthorize
<?php
namespace App\Http\Controllers;
use Illuminate\Contracts\Hashing\Hasher;
use Illuminate\Http\Request;
class ReauthorizeController extends Controller
{
/**