How to pass controller data to view in Laravel

I'd like to know how to pass my controller data to the view using Laravel. This my Controller:

     $ourput =   DB::table('database')
                    ->leftjoin('table', 'database.id', '=', 'table.id')
                  //  ->leftjoin('table', 'table.type_id', '=', 'table.type.id')
                    ->where('database.id', '=', $sess_id )
                     -


                     ->get();
             if($Data){
                return redirect('view')->with('key', $value); 
            }else{
                return FALSE;
            }

        }

Upvotes: 0

Views: 72

Answers (1)

George Hanson
George Hanson

Reputation: 3030

I believe you should be trying to return a view, not a HTTP redirect response. In which case instead of this:

return redirect('driverprofile')->with('driverprofiles', $driverData);

it should read something like this

return view('driverprofile')->with('driverprofiles', $driverData);

Upvotes: 1

Related Questions