Skip to content

Instantly share code, notes, and snippets.

@burakerdem
Last active December 9, 2015 23:58
Show Gist options
  • Save burakerdem/4347551 to your computer and use it in GitHub Desktop.
Save burakerdem/4347551 to your computer and use it in GitHub Desktop.
Laravel4 installation.

Laravel4 Installation

Create project directory

$ mkdir $APPDIR && cd $APPDIR

Clone Illuminate App

$ git clone https://github.com/illuminate/app.git

Install everything via Composer

$ composer install

Write permissions for /app/storage directory

$ sudo chmod -R 777 app/storage

Make a new controller

$ php artisan controller:make SampleController

Add resource in routes.php

Route::resource('sample', 'SampleController');

Dump autoload

$ composer dumpautoload

Database connection (if MAMP is used)

<?php

return array(
	'connections' => array(
		'mysql' => array(
			'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock'
		)
	)
);

Enable migrations

$ php artisan migrate:install

Create sample migration

$ php artisan migrate:make create_comments_table --create="comments"
<?php
public function up()
{
    Schema::create('comments', function($table)
	{
		$table->increments('id');
		$table->string('title');
		$table->text('body');
		$table->integer('author');
	});
}

public function down()
{
	Schema::drop('comments');
}
$ php artisan migrate

Seeding the table

<?php
// app/database/seeds/comments.php

return [
    [
        'title' => 'hello there',
        'body'  => 'I wish you a warm welcome',
        'author' => '5'
    ],
    [
        'title' => 'Another hello',
        'body' => 'I want to greet you another time',
        'author' => '1'
    ]
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment