Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Nate Ritter nateritter

🎯
Focusing
View GitHub Profile
@alexmac05
alexmac05 / gist:efef7a557fcc7ccc89bd17b5ac3cb1a9
Created Apr 19, 2018
HelloSign - Overriding the app white labelling settings when doing the embedded iframe loading in JavaScript
View gist:efef7a557fcc7ccc89bd17b5ac3cb1a9
HelloSign.init("<?php echo $client_id ?>");
HelloSign.open({
url: "<?php echo $sign_url ?>",
allowCancel: true,
skipDomainVerification: true,
@thijskok
thijskok / config.yml
Last active May 28, 2021
CircleCI 2.0 Laravel build configuration with PHP 7.1, NodeJS, and MySQL support. Runs both PHPunit as well as Laravel Dusk. Proper GD configuration for image editing purposes. Several linters included (requires including them in composer / package.json).
View config.yml
version: 2
jobs:
build:
working_directory: ~/user/repo
environment:
BASH_ENV: ~/.bashrc
docker:
@paulund
paulund / phpcs.xml
Created Aug 20, 2017
PHP PSR-2 CodeSniffer Config for Laravel
View phpcs.xml
<?xml version="1.0"?>
<ruleset name="Laravel Standards">
<!--
The name attribute of the ruleset tag is displayed
when running PHP_CodeSniffer with the -v command line
argument. The description tag below is not displayed anywhere
except in this file, so it can contain information for
developers who may change this file in the future.
-->
View UsedByTeams.md

UsedByTeams Model Trait For Laravel Spark

Automatically limit your models to the current team

So you're using spark, and you have teams enabled. You start creating models and want to have them be team specific. Instead of writing, Model::where('team_id', auth()->user()->currentTeam->id)->get(); use this trait to add that behind the scenes so that every time you call on your model, it's assumed that you mean for the current team.

This assumes that the model has a team_id, while it adds a scope of where team_id = currentTeam->id.

Note: Implicit Route Model Binding in 5.2, auth session doesn't exist at the point of this trait causing issue. fixed in 5.3

@dillinghamio
dillinghamio / SparkRoleMiddleware.md
Last active May 17, 2020
Team Role Middleware For Laravel Spark
View SparkRoleMiddleware.md

Team Role Middleware For Laravel Spark

Makes it simple to use Spark's role feature on routes

Route::group(['middleware'=>'role:owner'], function(){
    // owners only
});

Route::group(['middleware'=>'role:member'], function(){
@adamwathan
adamwathan / belongs-to-many.sublime-snippet
Last active Oct 19, 2020
Eloquent Relationship snippets for Sublime Text
View belongs-to-many.sublime-snippet
<snippet>
<content><![CDATA[
public function ${1:relationship}()
{
return \$this->belongsToMany(${1/^(.+)$/(?1\u$1:)/g}::class, {$2:table});
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>belt</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
@soufianeEL
soufianeEL / laravel.js
Last active Oct 30, 2021 — forked from JeffreyWay/laravel.js
You use Laravel 5 and you want to send a DELETE request without creating a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. To use, import script, and create a link with the `data-method="DELETE"` and `data-token="{{csrf_token()}}"` attributes.
View laravel.js
/*
Exemples :
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}">
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}" data-confirm="Are you sure?">
*/
(function() {
@njh
njh / install-rbenv.sh
Last active Mar 21, 2021
Install/update rbenv
View install-rbenv.sh
# Download rbenv
if [ ! -d ~/.rbenv ]; then
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
fi
cd ~/.rbenv
git reset --hard
git pull origin master
@brandonferens
brandonferens / loadRelativeAssets.php
Created Aug 20, 2014
Load relative javascript assets based on route in Laravel
View loadRelativeAssets.php
function loadRelativeAssets()
{
$routeArray = explode('.', Route::currentRouteName());
// We take the current route, create an array form it, run it
// through the while statement checking to see if that file exists.
// If it does, we load it. Then we remove that last element
// from the array, and do it all again, until the array is empty
while (!empty($routeArray)) {
// Create the path to the js file