how to search data from database using array

Posted 3 months ago by tanveerkhanwd

My controller Page:

public function index(Request $request)
    {
        $search = \Request::get('search');
        $records = config('constant.displayPageRecords');
        
        
        
        $aCon=array();
        if (!empty($search)) {
            $aCon = array
             (
                array('name','like',$search),
                array('city','like',$search),
                array('type','like',$search)
                
             );
        }
        
        $admission = Admission::where($aCon)->paginate($records);
        print_r($aCon);
        return view('admin.admission.index',['admission'=>$admission,'records'=>$records]);
    }

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

Reply to

Use Markdown with GitHub-flavored code blocks.