Posts Tagged‘laravel’

Laravel Cookies

Laravel Cookies

Using Cookies in Laravel is super easy. Take a look at how we can use cookies in Laravel below:

1. To Set a cookie you can use the following code:

$ref = 'my cookie value';
return redirect('/')->withCookie('ref', $ref);

2. Then to get a cookie value you can do the following:

$cookie = $request->cookie('ref');

And it’s as easy as that. To learn more about laravel cookies you can visit the official documentation.

Additionally you can learn more about Laravel cookies by checking out this video by DevDojo:

Learn how to use laravel cookies


Laravel 4.3 – What’s New

There has been a lot of buzz lately about the latest release of Laravel 4.3. Many new features will be introduced in this new version, and it is all being covered over at Laracasts. This is showing to be a larger release than was previously anticipated.


Here are a few of the key features that will be introduced in this latest version:

  • New directory structure
  • Method Injection
  • New and improved validation
  • New File Generators
  • Flysystem
  • Socialite
  • Illuminate Contracts
  • Route Caching

Now, I’m not too sure how I feel about the new file structure, already covered in one of Laracasts latest videos: I’m sure there’s good reasoning behind it; however, at first glance I’m not too thrilled about this.

There seem to be many other cool features popping up, so since Taylor Otwell has proven good in the past I’ll trust him on the change to the file structure and to all the new features. “Taylor”, thanks for continuing your awesome development on one of the greatest frameworks available.

If you want to catch all the latest features in the latest release be sure to head over to Laracasts, where Jeffrey Way will be teaching us all what we can expect from this next exciting release.

Loading Video...
Close Video Installing Laravel on Amazon EC2

Installing Laravel on Amazon EC2

Play Video

Amazon EC2 makes it very easy to scale the servers that our web applications live on. This video tutorial will show you how to load up an Amazon EC2 ubuntu server and setup Apache, PHP, & MySQL on the server. I will then go through the basics of setting up the environment for a basic Laravel 4 installation.

Here is the cheat sheet of commands that I was using throughout the video:

———- Installing Apache ———-

$ sudo apt-get install apache2

———- Installing Latest PHP ———-

$ sudo add-apt-repository ppa:ondrej/php5
$ sudo apt-get update
$ sudo apt-get install php5 libapache2-mod-php5

———- Installing PHP Mcrypt ext. ———-

$ sudo apt-get install php5-mcrypt

———- Installing MYSQL ———-

$sudo apt-get install mysql-server

———- Installing GIT ———-

$ sudo apt-get install git-core

———- Laravel GIT Repo ———-

———- Installing Composer ———-

curl -sS | php

Here are a few additional resources:
This is the command I used at the beginning of the video to run apt-get update:

$sudo apt-get update --fix-missing

Here is the URL to the documentation on how to SSH into your Amazon EC2 instance:

How to add a new column to the database using migrations

Using migrations in laravel 4 allows users to keep a version control of their database. If you aren’t familiar with migrations I’ll give you a quick rundown. A migration is a file that creates, updates, or removes tables and columns in your applications database. So, in order to add a new table using laravel 4 and migrations you can simple use the terminal and execute the following command line:

  php artisan migrate:make add_details_column_to_course_table

This will simply create a new file inside of your /app/database/migrations/ folder. Once you open that file you’ll see an ‘up’ method and a ‘down’ method. You can then simply change your up method to the following:

public function up()
	Schema::table('courses', function($table)

Then you can change your down method to look similar to this:

public function down()
	Schema::table('courses', function($table)

Then in your terminal command line you will simply run ‘php artisan migrate’, and your new column will be added to your database. Your table ‘courses’ will now have a new column named ‘description’ and your app can always be rolled back to before you added that new column.

I hope this can help someone else out. I am basically writing this post for personal documentation sake, but if it helps out someone else then that just makes the reason for writing this post that much better :)

Loading Video...
Close Video laravel-4-simple-authentication

Laravel 4 – Simple Authentication

Play Video

Laravel 3 & Laravel 4 are fairly different. The concepts are the same; however, there are some things that someone might get caught up in when migrating from version 3 to version 4. So, I thought I would create another tutorial on creating a simple authentication system with Laravel 4. Checkout the short video below on how to easily create a basic user authentication system using L4.

Hello Bundle – Creating Bundles with Laravel

Laravel is a great PHP framework for rapidly building web applications. One of the advantages of using Laravel is the ability to create re-usable pieces of code. Yes, you could always use libraries and third-party classes; however, Laravel has introduced a new way of building plug’n play pieces of functionality into your application which are called Bundles. In this video tutorial I will walk you through creating your first simple Laravel Bundle. It’s basically a ‘Hello World’ tutorial for bundles, but it’s called ‘Hello Bundle’. Anyway, Check out the video below: