Yet another

laravel journey

27/12/14 composer , laravel 5 , packages , packagist

Install new dependencies

If you would like to install dependencies in laravel there are 2 ways to do so, you can either open up your composer.json file and edit it to put in the dependencies you would like to include inside your project. This is an example of what can be found inside my composer.json file:

"require": {
	"laravel/framework": "4.2.*"
"require-dev": {
	"way/generators": "~3.0",
	"codeception/codeception": "~2.0"

Continue reading

0 likes no responses
27/12/14 homestead , mysql , phpmyadmin , vagrant

How to install phpmyadmin on vagrant box

Login to your virtual box using SSH and change directory to the folder which hosts your code. In my case this is the Code directory, use the following command to install phpmyadmin.

sudo apt-get install phpmyadmin

Note: The default username and password for the mysql servers are root – secret

Continue reading

0 likes no responses
16/11/14 blade , templates

Flexible blade setup

Once you have noticed the breeze the blade templating engine will bring into your templates, it’s about time to share a flexible template setup. I’ll share mine below but it’s by far the best setup in every situation.

Our file structure:

- master.blade.php

- header.blade.php
- menu.blade.php

- page1.blade.php
- page2.blade.php

Continue reading

0 likes no responses
16/11/14 installation , laravel 5

Installing latest Laravel (development) release

I’ve been experimenting with Laravel 5.x lately to get up to speed with the latest stuff being released. This is how to start a new project with the latest development version:

composer create-project laravel/laravel app-name dev-develop
0 likes no responses
16/11/14 AMPPS , error

Unable to change PHP version in AMPPS

Lately I switched from MAMP to AMPPS but I’m still a bit unsure if that was the right move. I got a bit tired with the MAMP interface and not having an easy softaculous installer for testing, though things worked perfect. Today I finally was able to solve a problem I was having with AMPPS for the last few weeks, I was unable to change the PHP version although all settings were fine. Typing this inside the terminal temporarily fixes it:

cd /Applications/AMPPS 

0 likes no responses
16/11/14 homestead , vagrant , virtual machine

Add new site to homestead (vagrant)

Like we have done before adding a new site is super easy. Just edit the homestead.yaml file and add a new site:

    - map:
      to: /home/vagrant/Code/site1/public
    - map:
      to: /home/vagrant/Code/site2/public

Continue reading

0 likes no responses
16/11/14 blade , laravel 5 , templates

Laravel Blade templates

If you have never worked with a templating engine it’s about time you open the door to let a breeze run through your projects! I’m sure you will be amazed about how easy Blade will be to use as well as how clean your templates will look. Sharpen your Blades, here we go!

This is what my controller function would look like, it’s called from the routes file and will make sure our application has maximum flexibility.

public function view() {
    $data['title'] = 'Titel pagina';
    $data['subtitle'] = 'Subtitel pagina';
    $data['random'] = rand(1,3);
    $data['loop'] = ['<em>Item 1</em>', '<i>Item 2</i>', '<b>Item 3</b>'];
    $data['users'] = [];
    return view('pages.example', $data);

Continue reading

0 likes no responses
14/11/14 error , laravel 5

Custom ‘Not found HTTP exception’

When you start doing routing and add some rules, in the beginning it’s easy to make a lot of mistakes. Because I didn’t want others to see the output laravel throws on the screen I decided to start looking for a solution to add custom error pages. In Laravel 5 you can get this done by going into app- Http - Kernel.php.

Here you should add the following to make sure the right class is called and a Response object can be made.

use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Response;

Continue reading

0 likes no responses
14/11/14 error , homestead , laravel 5 , vagrant

Vagrant timeouts

Ever since I upgraded my virtualbox I was having issues with vagrant when I returned from standby. The pages I was trying to load kept going until they gave me a gateway timeout.

The following command seems to solve the virtualbox issue and will ensure your vagrant box will be running better then ever after a return from standby!

sudo launchctl load /Library/LaunchDaemons/org.virtualbox.startup.plist

Continue reading

0 likes no responses
14/11/14 laravel 5 , routing

Laravel routing

Most, if not all, routing will be done inside the app/routes.php file. Here you’ll already find a very basic example which will be called to view the first template, I’ve extended mine with a few others to experiment a bit.

$router->get('/about', 'PagesController@about');

Continue reading

0 likes no responses