php - Serialization of 'PDO' is not allowed - Laravel caching with Datatable

if (!Cache::store('file')->has('channel')) {
$products = Channel::select('*');
Cache::store('redis')->put('channel', $products, 86400);
}
$products = Cache::store('redis')->get('channel', []);
return DataTables::eloquent($products)
->addIndexColumn()
->make(true);
This throws me "Serialization of 'PDO' is not allowed", if i am trying
if (!Cache::store('file')->has('channel')) {
$products = Channel::select('*')->get();
Cache::store('redis')->put('channel', $products, 86400);
}
$products = Cache::store('redis')->get('channel', []);
return DataTables::eloquent($products)
->addIndexColumn()
->make(true);
then datatables throws error of Method Illuminate\Database\Eloquent\Collection::getQuery does not exist
Anyone have solution for these?
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: cannot add or update a child row: a foreign key constraint fails
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.