Пример #1
0
 public function getCategories()
 {
     //	Query the category and its count from DB
     $urls = Url::select(\DB::raw('count(category) as count, category as name'))->groupBy('category')->get();
     //	Build the response Object
     $res = new \stdClass();
     $res->status = "Success";
     $res->data = $urls;
     $res->count = $urls->count();
     // Send the response object as json in response
     return response()->json($res);
 }