E
E
Emil Rakhmatullin2019-06-25 13:22:19
Laravel
Emil Rakhmatullin, 2019-06-25 13:22:19

Can't use thumbnail() function. Why?

Here is the controller:

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Foundation\Validation\ValidatesRequests;
use TCG\Voyager\Traits\Resizable;
use App\Blog;
use DB;

class BlogController extends Controller
{

  use ValidatesRequests;
  use Resizable;

  public function index()
  {
    $posts = DB::table('posts')->orderBy('created_at', 'desc')->paginate(5);
    return view('blog', compact('posts'));
  }
}

And this is how I render the image:
@foreach( $posts as $post )
            <img src="{{ Voyager::image($post->thumbnail('small')) }}" alt="">
@endforeach

The function itself is stored here -> \vendor\tcg\voyager\src\Traits\Resizable.php
I would be very grateful for the help!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question