PHP code example of laravie / html
1. Go to this page and download the library: Download laravie/html library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
laravie / html example snippets
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
],
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
],
{!! Form::open(['url' => 'foo/bar']) !!}
//
{!! Form::close() !!}
echo Form::open(['url' => 'foo/bar', 'method' => 'put'])
echo Form::open(['route' => 'route.name'])
echo Form::open(['action' => 'Controller@method'])
echo Form::open(['route' => ['route.name', $user->id]])
echo Form::open(['action' => ['Controller@method', $user->id]])
echo Form::open(['url' => 'foo/bar', 'files' => true])
echo Form::token();
Route::post('profile', ['before' => 'csrf', function() {
//
}]);
echo Form::model($user, ['route' => ['user.update', $user->id]])
echo Form::label('email', 'E-Mail Address');
echo Form::label('email', 'E-Mail Address', ['class' => 'awesome']);
echo Form::text('username');
echo Form::text('email', '[email protected] ');
echo Form::password('password', ['class' => 'awesome']);
echo Form::email($name, $value = null, $attributes = []);
echo Form::file($name, $attributes = []);
echo Form::checkbox('name', 'value');
echo Form::radio('name', 'value');
echo Form::checkbox('name', 'value', true);
echo Form::radio('name', 'value', true);
echo Form::number('name', 'value');
echo Form::date('name', \Carbon\Carbon::now());
echo Form::file('image');
echo Form::select('size', ['L' => 'Large', 'S' => 'Small']);
echo Form::select('size', ['L' => 'Large', 'S' => 'Small'], 'S');
echo Form::select('size', ['L' => 'Large', 'S' => 'Small'], null, ['placeholder' => 'Pick a size...']);
echo Form::select('animal', [
'Cats' => ['leopard' => 'Leopard'],
'Dogs' => ['spaniel' => 'Spaniel'],
]);
echo Form::selectRange('number', 10, 20);
echo Form::selectMonth('month');
echo Form::submit('Click Me!');
echo Form::button('Click Me!');
echo Form::button('<i class="fa fa-trash><i> Destroy"', ['class' => 'btn btn-danger'], false);
Form::macro('myField', function() {
return '<input type="awesome">';
});
echo Form::myField();
Form::component('bsText', 'components.form.text', ['name', 'value', 'attributes']);
// resources/views/components/form/text.blade.php
<div class="form-group">
{{ Form::label($name, null, ['class' => 'control-label']) }}
{{ Form::text($name, $value, array_merge(['class' => 'form-control'], $attributes)) }}
</div>
Form::component('bsText', 'components.form.text', ['name', 'value' => null, 'attributes' => []]);
{{ Form::bsText('first_name') }}
<div class="form-group">
<label for="first_name">First Name</label>
<input type="text" name="first_name" value="" class="form-control">
</div>
echo link_to('foo/bar', $title = null, $attributes = [], $secure = null);
echo link_to_asset('foo/bar.zip', $title = null, $attributes = [], $secure = null);
echo link_to_route('route.name', $title = null, $parameters = [], $attributes = []);
echo link_to_action('HomeController@getIndex', $title = null, $parameters = [], $attributes = []);