Skip to main content

Posts

Showing posts with the label laravel validate image

Laravel Validation Image Example

Hi Guys, Today, I will learn you to create validation image in laravel.we will show example of laravel validation image.The file under validation must be an image (jpg, jpeg, png, bmp, gif, svg, or webp). Here, I will give you full example for simply image validation in laravel bellow. solution $request->validate([ 'file' => 'image' ]); Route : routes/web.php Route::get('form/create','FromController@index'); Route::post('form/store','FromController@store')->name('form.store'); Controller : app/Http/Controllers/BlogController.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\Blade; use App\Models\User; use App\Models\Post; class FromController extends Controller { /** * Write code on Method * * @return response() */ public function create() { return view('form'); } /** * Write code on Method