Laravel Cheat Sheet
laravel v5
Routes
Routes
route path to a controller
vi /appname/app/Http/routes.php
DB Migrations
DB Migrations
Controllers
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
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">