First, make sure you have gulp installed. npm install –global gulp Then run npm install in order to install Elixir.
Tag: php
Form Model Binding in Laravel 5 with FormBuilder
Here’s an example of how to use form-model binding with FormBuilder. {!! Form::model($user, [‘route’ => [‘users.update’, $user->id], ‘method’ => ‘PATCH’]) !!}
Generate Excerpt without Breaking a Word
Here’s a little snippet for generating an excerpt without breaking up a word: function excerpt($string=”, $maxChar=50, $uri=’#’) { $length = strlen($string); if ($length < $maxChar) { return $string; } $trimmedString = substr($string, 0, $maxChar); $choppedString = substr($trimmedString, 0, strrpos($trimmedString, strrchr($trimmedString, ‘ ‘))); $newString = $choppedString . ‘ <a href=”‘ . $uri . ‘”>more</a>’; return $newString;… Continue reading Generate Excerpt without Breaking a Word
Get the portion of a string after the last occurrence of a character
Here’s a quick php snippet to get a substring after a specific character. In this example, it gets everything after the “_”. substr(strrchr($fieldname, “_”), 1);
Laravel Project Setup
First, get composer if you don’t already have it (Windows): https://getcomposer.org/Composer-Setup.exe I like to use the composer installer (as opposed to the Laravel Installer). Open command prompt and move into www directory (or wherever you want your project to live). composer create-project laravel/laravel name-of-project This will create the directory “name-of-project” and place all the laravel… Continue reading Laravel Project Setup
Laravel on Bluehost Shared Hosting
Project Code Create new directory at root called “laravel” and put entire project minus the public folder there. Create a new .env file and call it .env.production. Change the values inside that file to reflect the production environment. Upload that file to the production server and rename it to .env. Public Code: Subdomain Do this… Continue reading Laravel on Bluehost Shared Hosting
Set up Laravel Environment on Elementary OS
Install Apache, PHP, MySQL You can probably skip this part if you’re going to only use Homestead. Just skip down to Install Composer. Apache Add Apache respository sudo add-apt-repository ppa:ondrej/apache2 Install Apache sudo apt-get update sudo apt-get install apache2