Laravel: Difference between revisions

From Leo's Notes
This page was last edited on 31 May 2015, at 23:18.
Created page with " == Installation == The composer command is an alias in the shell that executes `php composer.phar`. Similarly, artisan executes `php artisan`. === New Project === composer..."
 
No edit summary
Line 11: Line 11:
You can see what packages and dependencies were installed by running:
You can see what packages and dependencies were installed by running:
  composer show -i
  composer show -i
== Usage ==
=== Views ===
==== Forms ====
Pull in the illuminate/html package.
composer require illuminate/html
Add the service provider to your config/app.php provider list and create a new facade.
'Form' => 'Illuminate\Html\FormFacade',
'Html' => 'Illuminate\Html\HtmlFacade',
In the blade templates, you can now use:
{!! Form::open() !!}}
  {!! Form::label('name', 'Name:') !!}}
  {!! Form::text('name', 'default', ['class' => 'blah'] ) !!}}
{!! Form::close() !!}}


[[Category:Coding]]
[[Category:Coding]]
[[Category:PHP]]
[[Category:PHP]]

Revision as of 23:18, 31 May 2015

Installation

The composer command is an alias in the shell that executes `php composer.phar`. Similarly, artisan executes `php artisan`.

New Project

composer create-project laravel/laravel projectname --prefer-dist

To clear the scaffolding that comes with the clean install:

artisan fresh

You can see what packages and dependencies were installed by running:

composer show -i


Usage

Views

Forms

Pull in the illuminate/html package.

composer require illuminate/html

Add the service provider to your config/app.php provider list and create a new facade.

'Form' => 'Illuminate\Html\FormFacade',
'Html' => 'Illuminate\Html\HtmlFacade',

In the blade templates, you can now use:

{!! Form::open() !!}}
  {!! Form::label('name', 'Name:') !!}}
  {!! Form::text('name', 'default', ['class' => 'blah'] ) !!}}
{!! Form::close() !!}}