I am trying to display information from the database and attach images to it - I want to follow the mvc template.
// Контроллер $events = Event::where('show_or_not', '=', 'show') ->get(); // А здесь мне нужно подцепить картинку для каждого id из перебора foreach ($events as $event) { if (file_exists(public_path( 'img/'.$event->id.'.jpg' ))) { $img = '<img src="public_path( img/'.$event->id.'.jpg )">' } } How to do it all right? Perhaps you need to register as a function in the model? And how then to display in the submission?