Exemplo n.º 1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $user = $this->user;
     $currency = setting('currency');
     $adtypes = Adtype::all();
     $numbers = $user->adtypes()->lists('number', 'adtype_id');
     return ['data' => compact('user', 'adtypes', 'numbers', 'currency')];
 }
Exemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $lambo = $this->getLamboData();
     $dodge = $this->getDodgeData();
     $villa = $this->getVillaData();
     $basic = Adtype::find(1);
     $gold = Adtype::find(3);
     $this->createAd($gold, $lambo);
     $this->createAd($basic, $dodge);
     $this->createAd($gold, $villa);
 }
Exemplo n.º 3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param Adtype $adtype
  *
  * @return Response
  */
 protected function destroy(Adtype $adtype)
 {
     $adtype->delete();
 }
Exemplo n.º 4
0
 /**
  * Choose the adType.
  *
  * @return Response
  */
 public function choose()
 {
     $adtypes = Adtype::all();
     return view_backend('ad.choose', compact('adtypes'));
 }
Exemplo n.º 5
0
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  *
  * @return void
  */
 public function boot(Router $router)
 {
     $router->bind('adWithTrashed', function ($id) {
         return Ad::with('content')->withTrashed()->findOrFail($id);
     });
     $router->bind('ad', function ($id) {
         return Ad::with('content')->findOrFail($id);
     });
     $router->bind('adCollection', function ($ids) {
         $ids = explode(',', $ids);
         return Ad::with('content')->withTrashed()->findMany($ids);
     });
     $router->bind('adstatus', function ($title) {
         return Adstatus::whereTitle($title)->firstOrFail();
     });
     $router->bind('adValidated', function ($id) {
         return Ad::with('content')->validate()->findOrFail($id);
     });
     $router->bind('adPreview', function ($id) {
         if (Auth::guard('admin')->check()) {
             return Ad::with('content')->withTrashed()->findOrFail($id);
         }
         if (Auth::guard('user')->check()) {
             return Auth::user()->ads()->with('content')->findOrFail($id);
         }
         abort(404);
     });
     $router->bind('adtypeNotCustomized', function ($id) {
         return Adtype::whereIsCustomized(0)->findOrFail($id);
     });
     $router->bind('adtypeCollection', function ($ids) {
         $ids = explode(',', $ids);
         return Adtype::findMany($ids);
     });
     $router->bind('templateCollection', function ($ids) {
         $ids = explode(',', $ids);
         return Template::findMany($ids);
     });
     $router->bind('encryptedOrderId', function ($enc) {
         $orderId = Crypt::decrypt($enc);
         return Order::findOrFail($orderId);
     });
     $router->bind('fieldCollection', function ($ids) {
         $ids = explode(',', $ids);
         return Field::findMany($ids);
     });
     $router->bind('subscriptionCollection', function ($ids) {
         $ids = explode(',', $ids);
         return Subscription::findMany($ids);
     });
     $router->bind('userCollection', function ($ids) {
         $ids = explode(',', $ids);
         return User::findMany($ids);
     });
     $router->bind('adUser', function ($id) {
         if (Auth::check()) {
             return Auth::user()->ads()->with('content')->findOrFail($id);
         } else {
             abort(404);
         }
     });
     $router->bind('field', function ($id) {
         return Field::with('search')->findOrFail($id);
     });
     $router->bind('visibleCategory', function ($id) {
         return Category::visible()->findOrFail($id);
     });
     $router->bind('templateblock', function ($identifier) use($router) {
         $page = $router->input('page');
         return Templateblock::whereIdentifier($identifier)->whereTemplateId($page->template->id)->firstOrFail();
     });
     $router->bind('widgetnode', function ($id) use($router) {
         $pageId = $router->input('page')->id;
         $templateblockId = $router->input('templateblock')->id;
         return Widgetnode::whereTemplateblockId($templateblockId)->wherePageId($pageId)->findOrFail($id);
     });
     $router->model('adtype', 'ZEDx\\Models\\Adtype');
     $router->model('template', 'ZEDx\\Models\\Template');
     $router->model('category', 'ZEDx\\Models\\Category');
     $router->model('country', 'ZEDx\\Models\\Country');
     $router->model('page', 'ZEDx\\Models\\Page');
     $router->model('menu', 'ZEDx\\Models\\Menu');
     $router->model('gateway', 'ZEDx\\Models\\Gateway');
     $router->model('themepartial', 'ZEDx\\Models\\Themepartial');
     $router->model('dashboardWidget', 'ZEDx\\Models\\Dashboardwidget');
     $router->model('searchfield', 'ZEDx\\Models\\SearchField');
     $router->model('selectfield', 'ZEDx\\Models\\SelectField');
     $router->model('subscription', 'ZEDx\\Models\\Subscription');
     $router->model('user', 'ZEDx\\Models\\User');
     parent::boot($router);
 }
Exemplo n.º 6
0
 protected function createGold()
 {
     Adtype::create(['title' => 'Gold', 'is_headline' => true, 'can_renew' => true, 'can_edit' => true, 'can_add_pic' => true, 'can_update_pic' => true, 'nbr_pic' => 10, 'nbr_days' => 90, 'can_add_video' => true, 'nbr_video' => 5, 'can_update_video' => true, 'price' => 4]);
 }