Skip to content

Commit

Permalink
Use Form Component and some little changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
bestmomo committed Sep 8, 2016
1 parent 67923fc commit 75905c2
Show file tree
Hide file tree
Showing 33 changed files with 187 additions and 231 deletions.
2 changes: 1 addition & 1 deletion app/Http/Requests/Auth/RegisterRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function rules()
return [
'username' => 'bail|required|max:30|alpha|unique:users',
'email' => 'bail|required|email|max:255|unique:users',
'password' => 'bail|required|min:3|confirmed',
'password' => 'bail|required|min:6|confirmed',
];
}
}
2 changes: 1 addition & 1 deletion app/Http/Requests/Auth/ResetPasswordRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function rules()
return [
'token' => 'required',
'email' => 'required',
'password' => 'bail|required|min:8|confirmed',
'password' => 'bail|required|min:6|confirmed',
];
}
}
2 changes: 1 addition & 1 deletion app/Http/Requests/UserCreateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function rules()
return [
'username' => 'bail|required|max:30|alpha|unique:users',
'email' => 'bail|required|email|unique:users',
'password' => 'bail|required|min:3|confirmed'
'password' => 'bail|required|min:6|confirmed'
];
}
}
29 changes: 29 additions & 0 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use App\Services\FormBuilder;

class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
FormBuilder::boot();
}

/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}
51 changes: 51 additions & 0 deletions app/Services/FormBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

namespace App\Services;

use Form;

class FormBuilder
{
/**
* Boot the Form Builder components.
*
* @return void
*/
public static function boot()
{
Form::component('submitBootstrap', 'components.submit', [
'value',
'class' => '',
]);
Form::component('destroyBootstrap', 'components.destroy', [
'value',
'message',
'class' => '',
]);
Form::component('controlBootstrap', 'components.control', [
'type',
'columns',
'name',
'errors',
'label' => null,
'value' => null,
'pop' => null,
'placeholder' => '',
]);
Form::component('checkboxBootstrap', 'components.checkbox', [
'name',
'label',
]);
Form::component('checkboxHorizontalBootstrap', 'components.checkboxHorizontal', [
'name',
'label',
'value',
]);
Form::component('selectBootstrap', 'components.select', [
'name',
'list' => [],
'selected' => null,
'label' => null,
]);
}
}
145 changes: 0 additions & 145 deletions app/Services/Html/FormBuilder.php

This file was deleted.

20 changes: 0 additions & 20 deletions app/Services/Html/HtmlServiceProvider.php

This file was deleted.

3 changes: 2 additions & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,11 @@
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
App\Services\Html\HtmlServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,
Magyarjeti\LaravelLipsum\LipsumServiceProvider::class,
App\Providers\ComposerServiceProvider::class,
App\Providers\ElfinderServiceProvider::class,
Expand Down
6 changes: 5 additions & 1 deletion resources/lang/fr/validation.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php

return [

Expand Down Expand Up @@ -140,6 +140,10 @@
'time' => 'Heure',
'available' => 'Disponible',
'size' => 'Taille',
'comments' => 'Commentaire',
'slug' => 'Permalien',
'summary' => 'Sommaire',
'log' => 'Connexion',
],

];
8 changes: 4 additions & 4 deletions resources/views/auth/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

<div class="row">

{!! Form::control('text', 6, 'log', $errors, trans('front/login.log')) !!}
{!! Form::control('password', 6, 'password', $errors, trans('front/login.password')) !!}
{!! Form::submit(trans('front/form.send'), ['col-lg-12']) !!}
{!! Form::check('memory', trans('front/login.remind')) !!}
{!! Form::controlBootstrap('text', 6, 'log', $errors, trans('front/login.log')) !!}
{!! Form::controlBootstrap('password', 6, 'password', $errors, trans('front/login.password')) !!}
{!! Form::submitBootstrap(trans('front/form.send'), 'col-lg-12') !!}
{!! Form::checkboxBootstrap('memory', trans('front/login.remind')) !!}
{!! Form::text('address', '', ['class' => 'hpet']) !!}
<div class="col-lg-12">
{!! link_to('password/reset', trans('front/login.forget')) !!}
Expand Down
4 changes: 2 additions & 2 deletions resources/views/auth/passwords/email.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

<div class="row">

{!! Form::control('email', 6, 'email', $errors, trans('front/password.email')) !!}
{!! Form::submit(trans('front/form.send'), ['col-lg-12']) !!}
{!! Form::controlBootstrap('email', 6, 'email', $errors, trans('front/password.email')) !!}
{!! Form::submitBootstrap(trans('front/form.send'), 'col-lg-12') !!}
{!! Form::text('address', '', ['class' => 'hpet']) !!}

</div>
Expand Down
14 changes: 7 additions & 7 deletions resources/views/auth/passwords/reset.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@

{!! Form::open(['url' => 'password/reset', 'method' => 'post', 'role' => 'form']) !!}

<div class="row">
<div class="row">

{!! Form::hidden('token', $token) !!}
{!! Form::control('email', 6, 'email', $errors, trans('front/password.email')) !!}
{!! Form::control('password', 6, 'password', $errors, trans('front/password.password'), null, [trans('front/password.warning'), trans('front/password.warning-password')]) !!}
{!! Form::control('password', 6, 'password_confirmation', $errors, trans('front/password.confirm-password')) !!}
{!! Form::submit(trans('front/form.send'), ['col-lg-12']) !!}
{!! Form::hidden('token', $token) !!}
{!! Form::controlBootstrap('email', 6, 'email', $errors, trans('front/password.email')) !!}
{!! Form::controlBootstrap('password', 6, 'password', $errors, trans('front/password.password'), null, [trans('front/password.warning'), trans('front/password.warning-password')]) !!}
{!! Form::controlBootstrap('password', 6, 'password_confirmation', $errors, trans('front/password.confirm-password')) !!}
{!! Form::submitBootstrap(trans('front/form.send'), 'col-lg-12') !!}

</div>
</div>

{!! Form::close() !!}

Expand Down
25 changes: 12 additions & 13 deletions resources/views/auth/register.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@

{!! Form::open(['url' => 'register']) !!}

<div class="row">
{!! Form::control('text', 6, 'username', $errors, trans('front/register.pseudo'), null, [trans('front/register.warning'), trans('front/register.warning-name')]) !!}
{!! Form::control('email', 6, 'email', $errors, trans('front/register.email')) !!}
</div>
<div class="row">
{!! Form::control('password', 6, 'password', $errors, trans('front/register.password'), null, [trans('front/register.warning'), trans('front/register.warning-password')]) !!}
{!! Form::control('password', 6, 'password_confirmation', $errors, trans('front/register.confirm-password')) !!}
</div>
{!! Form::text('address', '', ['class' => 'hpet']) !!}

<div class="row">
{!! Form::submit(trans('front/form.send'), ['col-lg-12']) !!}
</div>
<div class="row">
{!! Form::controlBootstrap('text', 6, 'username', $errors, trans('front/register.pseudo'), null, [trans('front/register.warning'), trans('front/register.warning-name')]) !!}
{!! Form::controlBootstrap('email', 6, 'email', $errors, trans('front/register.email')) !!}
</div>
<div class="row">
{!! Form::controlBootstrap('password', 6, 'password', $errors, trans('front/register.password'), null, [trans('front/register.warning'), trans('front/register.warning-password')]) !!}
{!! Form::controlBootstrap('password', 6, 'password_confirmation', $errors, trans('front/register.confirm-password')) !!}
</div>
{!! Form::text('address', '', ['class' => 'hpet']) !!}
<div class="row">
{!! Form::submitBootstrap(trans('front/form.send'), 'col-lg-12') !!}
</div>

{!! Form::close() !!}

Expand Down
2 changes: 1 addition & 1 deletion resources/views/back/blog/table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<td>{!! link_to_route('blog.edit', trans('back/blog.edit'), [$post->id], ['class' => 'btn btn-warning btn-block']) !!}</td>
<td>
{!! Form::open(['method' => 'DELETE', 'route' => ['blog.destroy', $post->id]]) !!}
{!! Form::destroy(trans('back/blog.destroy'), trans('back/blog.destroy-warning')) !!}
{!! Form::destroyBootstrap(trans('back/blog.destroy'), trans('back/blog.destroy-warning')) !!}
{!! Form::close() !!}
</td>
</tr>
Expand Down
Loading

0 comments on commit 75905c2

Please sign in to comment.