In this tutorial, I will help you to give an example of laravel check if file is empty. If you work on file uploading or image uploading then you have to require to check file array is empty or not.
Here Example,
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class PostController extends Controller
{
/**
* Write code on Method
*
* @return response()
*/
public function index(Request $request)
{
if ($request->hasFile('image')) { // Add input file name
// Your Code
}
}
}
Please use hasFile() Method to check file exist or not.
Thanks