1 year ago

variable error

Posted 1 year ago by arctushar
$date=Dsedata::select('date')->where('codelist_id',2)->orderBy('created_at', 'desc')->first()->date;
        return $coderesults=Codelist::with(['otherdata','dsedata'=>function($dquery){
        },'sector','meeting','comments' => function($query)
            $query->with('user')->where('published', 'yes');


above is my code in controller

and error is as below

ErrorException (E_NOTICE)
Undefined variable: date

and its showing in line "$dquery->where('date',$date);"

what is the solution

Please sign in or create an account to participate in this conversation.