jimothee's avatar

jimothee wrote a reply+100 XP

3d ago

i have that in my form. heres all of it

jimothee's avatar

jimothee wrote a reply+100 XP

3d ago

idk why but i didnt. I just tried it and it didn't work, still showing Path must not be empty with

 $extra['thumbnail'] = $request->file('thumbnail')->store('thumbnails', 'public');}

highlighted

jimothee's avatar

jimothee started a new conversation+100 XP

3d ago

here is my store function in controller

	        $request->validate([
            'description' => 'required',
            'title' => 'required',
            'thumbnail' => 'required',
        ]);

        $extra = $request->except(['thumbnail', 'background_image', '_token']);
        $extra['type'] = 'comic';
        $extra['thumbnail'] = dd($request->file('thumbnail'))->store('thumbnails', 'public');
        if($request->hasFile('background_image')) {
        $extra['background_image'] = $request->file('background_image')->store('bgs', 'public');
        }

        Short::create($extra);

        return redirect()->route('index');

When i enter information into my form it highlights this line

$extra['thumbnail'] = $request->file('thumbnail')->store('thumbnails', 'public');

And tells me Path cannot be empty, even though i already ran php artisan storage:link. When i added dd it showed me my realPath: false so i tried using storeAs instead instead of store and it showed me the exact same error. Whats wrong with my code? I just want it to be added into my database.

jimothee's avatar

jimothee wrote a reply+100 XP

1w ago

I want to update my php version though to match the one laragon uses, which is the latest

jimothee's avatar

jimothee started a new conversation+100 XP

1w ago

I recently bought Laragon and when i tried to make a controller in my new laravel project it told me: "PHP Fatal error: Uncaught RuntimeException: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.3.0". You are running 8.2.12. in C:\laragon\www\qna\vendor\composer\platform_check.php:22 Stack trace:"

Im confused because I have the latest version of composer and php, but when I php -v it says my version is PHP 8.2.12, but in Laragon its the latest version. I tried running things like sudo composer self-update, but that did nothing. Help would be appreciated.