jimothee wrote a reply+100 XP
3d ago
i have that in my form. heres all of it
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form action="{{ route('extra.store') }}" method="POST" enctype="multipart/form-data">
@csrf
<div>
<label for="">description</label>
<textarea name="description" id=""></textarea>
</div>
<div>
<label for="">title</label>
<input type="text" name="title">
</div>
<div>
<label for="">bg image</label>
<input type="file" name="background_image">
</div>
<div>
<label for="">box bg color</label>
<input type="text" name="background_color">
</div>
<div>
<label for="">desc text color</label>
<input type="text" name="desc_textco">
</div>
<div>
<label for="">title text color</label>
<input type="text" name="title_textco">
</div>
<div>
<label for="">description font</label>
<input type="text" name="desc_font">
</div>
<div>
<label for="">title font</label>
<input type="text" name="title_font">
</div>
<div>
<label for="">music url</label>
<input type="text" name="music_url">
</div>
<div>
<label for="">thumbnail</label>
<input type="file" name="thumbnail">
</div>
<div>
<label for="">title outline color</label>
<input type="text" name="title_outline_color">
</div>
<div>
<label for="">description outline color</label>
<input type="text" name="description_outline_color">
</div>
<div>
<input type="submit" value="make extra">
</div>
</form>
</body>
</html>
jimothee wrote a reply+100 XP
3d ago
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 wrote a reply+100 XP
1w ago
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.