0

am trying to populate the database using terminal but am getting the error below when i upload an image

PHP Fatal error: Call to undefined function cover_image() in Psy Shell code on line 1

This is what i was inserting in database

$event=new App\Event
$event-->cover_image('/assets/photos/event4.jpg')
pimarc
  • 3,621
  • 9
  • 42
  • 70

1 Answers1

0

Try changing --> into ->, like so:

$event->cover_image('/assets/photos/event4.jpg')

This might be what causes your error.

Then update your blade file to display the image using the string from the database:

<img src="{{ public_path($event->conver_image) }}">

or depending of your full path:

<img src="{{ url('your/path'.$event->conver_image) }}">

pimarc
  • 3,621
  • 9
  • 42
  • 70
  • i corrected that but it doesnt save the image it saves a string i cant display it on the blade view it says cannot find resource –  Nov 09 '19 at 12:21
  • You can not same an image in the database, you can only save a path to an image (a string indeed). In your blade file, you should do something like: `` – pimarc Nov 09 '19 at 12:32