Skip to content

Instantly share code, notes, and snippets.

@roni-estein
roni-estein / .bash_aliases
Last active November 21, 2021 21:11
Shortcuts for Laravel & PHP Storm
export PATH="~/.composer/vendor/bin:$PATH"
export EDITOR='subl -w'
# export CLICOLOR=1
# export LSCOLORS=ExFxCxDxBxegedabagacad
#ALIASES
#COMMANDS
@roni-estein
roni-estein / MakeViewCommand.php
Created June 23, 2018 19:46
Make View Command for Laravel 5.6, place in app/Console/Commands/ you need to register it in 5.5 and below.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class MakeViewCommand extends Command
{
/**
* The name and signature of the console command.
@roni-estein
roni-estein / TestCase.php
Last active November 19, 2018 18:29
A series of general helper macro's that apply to all tests
<?php
// To make this file work properly, you must create the App\Helpers\Model
// class, and have all models inherit from this class.
namespace Tests;
use App\Helpers\Model;
use PHPUnit\Framework\Assert;
use Illuminate\Support\Collection as BaseCollection;
@roni-estein
roni-estein / composer.json
Last active July 12, 2018 17:20
composer.json autoload section to add test utilities and whatever production
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
},
"files": [
"app/Helpers/calculations.php"
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
@roni-estein
roni-estein / index.html
Created August 24, 2018 07:40
UI: Button morphing into form
<div class="container" id="app">
<div class="add-product" :class="{'open': formOpen}">
<div class="button-copy" v-show="!formOpen" @click="formOpen = true">Add Product</div>
<form @submit="cancel()">
<div class="form--field">
<label>Product Title *</label>
<input type="text" class="form--element" name="title" v-model="productData.title" placeholder="Title" required="">
</div>
<div class="form--container -inline">
<?php
namespace App\Helpers;
use Illuminate\Database\Eloquent\Model as EloquentModel;
// This now makes a non abstract version of model so we can
// add macro's to model in certain situations like testing
class Model extends EloquentModel
<?php
namespace Tests;
use App\Account;
use App\CompressionProfile;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Auth\SessionGuard;
// This sits on top of the regular test case and allows for macros
<?php
namespace Tests;
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
// Use this area to add macros that are relevant to the database
// It will have access to testcase and domain test case. But
<?php
namespace Tests;
/**
* Laravel + PHPUnit assert that blade files are being loaded.
*
* Trait AssertView
*/
trait Viewable