Working with Datatables and other collections

Posted 5 months ago by Aron-Spiess

I need some help with returning more than just the datatables data, I'd like to return results from two other sql queries.

// normal way to call back the datatable
        return DataTables::of($comments_list)
            ->rawColumns(['title'] ,['comment'] ,['created_by'] ,['comment_date'])
// normal way to call back sql query collections
return view('dashboard.commentslist', compact('owners','admins'));

I assume I can add the compact('owners','admins')); but when I try to reference these in my blade I get an undefined variable

I'm not looking to use the data with my datatable more so just on the blade where the datatable displays

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

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.