اذهب إلى المحتوى
  • 0

a problem in eloquent

Ahmed Alsalih

السؤال

laravel saves my edited from the form images as tmp files, didn't find any up to date online slutions, can you help me? 

notes: the images are being stored currectly, it's just that they don't show when called in html files, and they're considered tmp in phpmyadmin

here is my controller

  public function update(Request $request, Post $post)
    {
        
        $data = $request->validate([
            'description' => 'required',
            'image' => ['nullable', 'mimes:png,jpg,jpeg']

        ]);

        
     
        if($request->has('image')){
            $image = $request['image']->store('posts','public');
            $date['image'] = $image; 
        }
         $post->update($data);
         return redirect('/p/' . $post->slug);


    }

 

رابط هذا التعليق
شارك على الشبكات الإجتماعية

Recommended Posts

  • 0


تبدو المشكلة هنا خطأ إملائي في الكود. يجب تغيير السطر:

$date['image'] = $image;

إلى:

$data['image'] = $image;

بعد إجراء هذا التغيير، يجب أن يتم تخزين الصورة بشكل صحيح

رابط هذا التعليق
شارك على الشبكات الإجتماعية

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...