Ejemplo n.º 1
0
 public function getAd(Request $request)
 {
     $response = [];
     if (empty($request->get('dma'))) {
         $response = \App\AdGeneral::get(1);
     } else {
         $dma = trim(strtolower($request->get('dma')));
         $response = \App\Ad::get($dma);
         if (empty($response)) {
             $response = \App\AdGeneral::get(1);
         }
     }
     return response()->json($response)->header('Access-Control-Allow-Origin', '*')->header('Access-Control-Allow-Methods', 'GET, POST')->setCallback($request->input('callback'));
 }
Ejemplo n.º 2
0
 public function getGeneralAds()
 {
     $ads = \App\AdGeneral::selectRaw(" id, copy, url_shorten `url`, is_active, 'general' as 'type'")->orderBy('created_at', 'desc')->get();
     return response()->json($ads);
 }