A Linux Enthusiast who loves to learn about programming and building applications for Medical billing, collections and accounting.

Find and Replace with Regex

In order to copy text that matches part of a regular expression you have to mark the part that you want to be able to copy. You do this with

Disabling Submit Button onClick

Sometimes I want to disable the submit button on click so that someone with slow internet doesn't submit a form multiple times. The fastest way to do it is this

MySQL get all column names


This command will get all column names in one table SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`='insertdatabasename' AND `TABLE_NAME`='inserttablename'; This will get columns from

Laravel Events Cheatsheet


Event::fire('foo.bar', array($bar)); Event::listen('foo.bar', function($bar){}); Event::listen('foo.*', function($bar){}); Event::listen('foo.bar', 'FooHandler', 10); Event::listen('foo.bar', 'BarHandler', 5)

cURL Requests in PHP


Introduction cURL allows transfer of data across a wide variety of protocols, and is a very powerful system. It's widely used as a way to send data across websites, including

Laravel Pagination Cheatsheet


Auto-Magic Pagination Model::paginate(15); Model::where('cars', 2)->paginate(15); "Next" and "Previous" only Model::where('cars', 2)->simplePaginate(15); Manual Paginator Paginator::make($items,

Laravel Eloquent Cheatsheet


Model::create(array('key' => 'value')); Find first matching record by attributes or create Model::firstOrCreate(array('key' => 'value')); Find first record by attributes or instantiate Model::firstOrNew(array(

Laravel Database Cheatsheet

 Laravel, MySQL

Laravel Database Eloquent DB::connection('connection_name'); DB::statement('drop table users'); DB::listen(function($sql, $bindings, $time){ code_here; }); DB::transaction(function(){ transaction_code_here; }); Cache a query for

Laravel URLs Cheatsheet

 Laravel, PHP

URL::full(); URL::current(); URL::previous(); URL::to('foo/bar', $parameters, $secure); URL::action('FooController@method', $parameters, $absolute); URL::route('foo', $parameters, $absolute); URL::secure('foo/bar', $parameters); URL::asset(

Laravel Log Cheatsheet


Log::info('info'); Log::info('info',array('context'=>'additional info')); Log::error('error'); Log::warning('warning'); Get monolog instance Log::getMonolog(); Add listener Log::listen(function($level, $message, $context)

Laravel App Cheatsheet


App::environment(); Test equal to App::environment('local'); App::runningInConsole(); App::runningUnitTests();

Laravel Routing Cheatsheet


Route::get('foo', function(){}); Route::get('foo', 'ControllerName@function'); Route::controller('foo', 'FooController'); RESTful Controllers Route::resource('posts','PostsController'); //Specify a subset of actions to handle on the route Route:

Laravel Configuration Cheatsheet


You may access configuration values using the Global config helper function from anywhere in the application. $value = config('app.timezone'); To set the config values at runtime, pass an array

Composer Cheat Sheet


You can use Composer to create new projects from an existing package. composer create-project laravel/laravel folder_name The install command reads the composer.json file from the current directory,