1

I have tried doing this

$query = "SELECT * FROM policies";
$policies = DB::select($query);

And also this $policies = Policy::all(); Whenever I try to do this, this happensenter image description here

here is my controller function

public function getPremiumCollectionReport (Request $request) {
    $policies = Policy::all();
    echo $policies;
}

Other queries run perfectly well for other models and tables. And if I run the raw query in the sql server, it runs perfectly as well. Can anyone help me find a solution? I don't have a clue.

Shateel Ahmed
  • 1,264
  • 2
  • 12
  • 23
  • You can put exception handling in the code and check what is the error by debugging the code.. – Chetan Jun 19 '17 at 05:10

1 Answers1

1

I just found out that there were too many policies in that table for the server to handle. If I run the query for a smaller number of policies, the query runs successfully. It only happens when I try to select a large number of policies.

Shateel Ahmed
  • 1,264
  • 2
  • 12
  • 23