Example of Form requests in Senither/ShareX-Media-Server

File app/Http/Requests/ImageUploadRequest.php (link to Github)
class ImageUploadRequest extends ApiRequest
{
    public function rules()
    {
        return [
            'image' => ['required', 'image', 'mimes:jpeg,png,jpg,gif'],
        ];
    }
}
File app/Http/Controllers/Api/ImageController.php (link to Github)
use App\Http\Controllers\Controller;
use App\Http\Requests\ImageUploadRequest;
use App\Models\Image;

class ImageController extends Controller
{
    //
    public function store(ImageUploadRequest $request)
    {
        $image = Image::createAndSave($request->file('image'));

        if ($request->header('Accept') == 'text/plain') {
            $image = $image->resource_url;
        }

        return response($image, 201);
    }
    //
}

Additional resources on Form requests: