Laravel Cheat Sheet

laravel v5

Routes

route path to a controller

vi /appname/app/Http/routes.php

DB Migrations

Controllers

Route::get('/', 'PagesController@home');

create new migration

php artisan make:migration <your_migration_name> --create=<table_name>

migrations are placed under /appname/database/migrations

create new controller using artisan

php artisan make:controller ControllerName

route path to a view

vi /appname/app/Httd/Controller/PagesController.php

<?php

namespace AppName\Http\Controllers;

use Illuminate\Http\Request;

use AppName\Http\Requests;

class PagesController extends Controller

{

public function home() {

return view('welcome');

}

}

CSS

location for css files

/appname/public/css/main.css

in layout pages, reference css file like this,

<link rel="stylesheet" href="css/main.css">