From 6d429d4a1f05ba2c5e73e7e9daf7c714173bfb26 Mon Sep 17 00:00:00 2001 From: Vincent BRIDIER Date: Mon, 18 May 2020 17:25:14 +0200 Subject: [PATCH] - Add img control --- app/Http/Controllers/EleveurController.php | 8 ++++---- resources/views/eleveurs/create.blade.php | 11 ++++++----- resources/views/eleveurs/edit.blade.php | 11 ++++++----- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/Http/Controllers/EleveurController.php b/app/Http/Controllers/EleveurController.php index 5a20ce1..8613b8d 100644 --- a/app/Http/Controllers/EleveurController.php +++ b/app/Http/Controllers/EleveurController.php @@ -40,8 +40,8 @@ class EleveurController extends Controller public function store(MyRequest $request) { $validatedData = $request->validate([ - 'photo1' => 'mimetypes:image/jpeg|max:500000', - 'photo2' => 'mimetypes:image/jpeg|max:500000', + 'photo1' => 'mimetypes:image/jpeg|max:1000', + 'photo2' => 'mimetypes:image/jpeg|max:1000', ]); @@ -119,8 +119,8 @@ class EleveurController extends Controller public function update(MyRequest $request, Eleveur $eleveur) { $validatedData = $request->validate([ - 'photo1' => 'mimetypes:image/jpeg|max:500000', - 'photo2' => 'mimetypes:image/jpeg|max:500000', + 'photo1' => 'mimetypes:image/jpeg|max:1000', + 'photo2' => 'mimetypes:image/jpeg|max:1000', ]); $datas = collect($request->all()); diff --git a/resources/views/eleveurs/create.blade.php b/resources/views/eleveurs/create.blade.php index 6dd2b16..554de74 100644 --- a/resources/views/eleveurs/create.blade.php +++ b/resources/views/eleveurs/create.blade.php @@ -110,22 +110,23 @@
- {!! Form::label('photo1', 'Photo 1', ['class' => 'col-sm-2 col-form-label']) !!} + {!! Form::label('photo1', 'Photo 1 (1Mo Max.)', ['class' => 'col-sm-2 col-form-label']) !!}
- {!! Form::file('photo1', ['class' => 'form-control']) !!} +
- {!! Form::label('photo2', 'Photo 2', ['class' => 'col-sm-2 col-form-label']) !!} + {!! Form::label('photo2', 'Photo 2 (1Mo Max.)', ['class' => 'col-sm-2 col-form-label']) !!}
- {!! Form::file('photo2', ['class' => 'form-control']) !!} +
+ {!! Form::button('Enregistrer', ['type' => 'submit', 'id' => 'submitForm', 'class' => 'btn btn-outline-primary']) !!}
{!! Form::close() !!} -@endsection \ No newline at end of file +@endsection diff --git a/resources/views/eleveurs/edit.blade.php b/resources/views/eleveurs/edit.blade.php index f6d7cc3..c2fd739 100644 --- a/resources/views/eleveurs/edit.blade.php +++ b/resources/views/eleveurs/edit.blade.php @@ -112,7 +112,7 @@
- {!! Form::label('photo1', 'Photo 1') !!} + {!! Form::label('photo1', 'Photo 1 (1Mo Max.)') !!} @if ($eleveur->path_photo1 && $eleveur->path_photo1 != '')
@@ -124,13 +124,13 @@ @if ($eleveur->path_photo1 && $eleveur->path_photo1 != '') @endif - {!! Form::file('photo1', ['class' => 'form-control']) !!} +
- {!! Form::label('photo2', 'Photo 2') !!} + {!! Form::label('photo2', 'Photo 2 (1Mo Max.)') !!} @if ($eleveur->path_photo2 && $eleveur->path_photo2 != '')
@@ -142,11 +142,12 @@ @if ($eleveur->path_photo2 && $eleveur->path_photo2 != '') @endif - {!! Form::file('photo2', ['class' => 'form-control']) !!} +
+ {!! Form::button('Mettre à jour', ['type' => 'submit', 'id' => 'submitForm', 'class' => 'btn btn-outline-primary']) !!}
{!! Form::close() !!} @@ -228,4 +229,4 @@ }) }) -@endsection \ No newline at end of file +@endsection