Laravel Form

Model Binding

// routes.php

	// route to show our edit form
	Route::get('nerd/edit/{id}', array('as' => 'nerd.edit', function($id) 
	{
		// return our view and Nerd information
		return View::make('nerd-edit') // pulls app/views/nerd-edit.blade.php
			->with('nerd', Nerd::find($id));
	}));

	// route to process the form
	Route::post('nerd/edit', function() {
		// process our form
	});
	



	{{ Form::model($nerd, array('route' => 'nerd.edit', $nerd->id)) }}	

		
		{{ Form::label('name', 'Name') }}
		{{ Form::text('name') }}

		
		{{ Form::label('email', 'Email') }}
		{{ Form::email('email') }}		

		{{ Form::submit('Update Nerd!') }}

	{{ Form::close() }}

source: http://scotch.io/quick-tips/php-tips/laravel-php/laravel-form-model-binding

Form model binding and file upload

Form model binding can be done by declaring form open as

 {{ Form::model($product, array('route' => array('product.postedit', $product->id), 'files'=> true)) }}	

source: http://stackoverflow.com/questions/20688289/form-model-binding-and-file-upload

Blogbook : PHP | Javascript | Laravel | Corcel | CodeIgniter | VueJs | ReactJs | WordPress