Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

$request laravel undefined inside function query

class BookController extends Controller
{
   public function bookIndex($id, $slug) {
   // echo $id works without a problem

   $findcover = Thing::with(array('cover' => function($query) use ($id) {
        $query->where('imageable_type', 'AppModelsThing')
              ->where('imageable_id', $id);
        }))->find($id);

        $maincover = $findcover->cover;
   }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #laravel #undefined #function #query
ADD COMMENT
Topic
Name
5+4 =