Skip to content

Instantly share code, notes, and snippets.

View Braunson's full-sized avatar

Braunson Yager Braunson

View GitHub Profile
@bobbybouwmann
bobbybouwmann / User.php
Last active May 31, 2024 03:04
Laravel Absolute vs Relative Dates with Carbon
<?php
namespace App;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
/**
@BARNZ
BARNZ / AppVersion.php
Created January 15, 2017 04:24
Laravel 5.x middleware to retrieve the version number from Node JS package.json
<?php
namespace App\Http\Middleware;
use Closure;
/**
* Reads the current version of the app into an APP_VERSION variable by reading
* the applications Node JS package.json file.
*
@alexellis
alexellis / pwd-faas.md
Last active January 19, 2017 15:49
pwd-faas-quickstart.md

FaaS - functions as a Service Quick Start / Test Drive

This page has moved into the repository!

Head over the to Github repository for the TestDrive document

@AlexR1712
AlexR1712 / bladeCompile.php
Last active December 5, 2022 07:20
Compile a string like Blade Template in Laravel
<?php
// Only you need to add in your controller.
public function bladeCompile($value, array $args = array())
{
$generated = \Blade::compileString($value);
ob_start() and extract($args, EXTR_SKIP);
// We'll include the view contents for parsing within a catcher
// so we can avoid any WSOD errors. If an exception occurs we
@patpohler
patpohler / Big List of Real Estate APIs.md
Last active December 23, 2025 06:51
Evolving list of Real Estate APIs by Category

Big List of Real Estate APIs

Listings / Property Data

####Rets Rabbit http://www.retsrabbit.com

Rets Rabbit removes the nightmare of importing thousands of real estate listings and photos from RETS or ListHub and gives you an easy to use import and Web API server so you can focus on building your listing search powered website or app.

@gilbitron
gilbitron / InvoicePaid.php
Created November 14, 2016 12:31
Convert the Laravel Spark invoice email to a notification email
<?php // app/Notifications/InvoicePaid.php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Laravel\Cashier\Invoice;
<?php
/**
* VentureApp
* https://www.ventureapp.com/
* email: [email protected]
*/
namespace App\Helpers;
class vaHelper
@gilbitron
gilbitron / curl-multi-test.php
Last active June 17, 2024 12:24
Testing 95 regular curl_exec requests vs curl_multi_exec requests
<?php
$sites = [
'http://www.google.com/',
'http://www.facebook.com/',
'http://www.youtube.com/',
'http://www.yahoo.com/',
'http://www.live.com/',
'http://www.wikipedia.org/',
'http://www.baidu.com/',
@sworup
sworup / laravel-validation-error.js
Last active July 9, 2021 13:04
Handling of Laravel validation message when pulled through Ajax request
error: function (request) {
// Validation error would return 422 header
if (request.status == 422) {
// Parser the json response expected
var $errors = $.parseJSON(request.responseText);
// Bootstrap alert scafolding for error
var errorsHtml = '<div class="alert alert-danger alert-dismissible"><button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button><h4><i class="icon fa fa-times"></i>Opps! Seems like you didn\'t fill the form properly...</h4><ul>';
// The root nodes are field names, with an array of error messages
$.each( $errors, function( key, value ) {
// We loop through the error to see if there are multiple error associated with the field
@jacurtis
jacurtis / App\Exceptions\Handler.php
Created July 28, 2016 02:31
How to get filp/whoops to work in Laravel 5.2 or 5.3 - Add this code to your `App\Exceptions\Handler.php` file.
/**
* Create a Symfony response for the given exception.
*
* @param \Exception $e
* @return mixed
*/
protected function convertExceptionToResponse(Exception $e)
{
if (config('app.debug')) {
$whoops = new \Whoops\Run;