public function delete_img($id)
 {
     $index = SliderImages::find($id);
     if (file_exists('public/upload/' . $index->img_url)) {
         unlink('public/upload/' . $index->img_url);
     }
     $index->delete();
     return Redirect::to('slider');
 }
Beispiel #2
0
 public function __construct()
 {
     mgActivateThisPlugin(__FILE__, array(__CLASS__, 'activate'));
     mgAddAction(__FILE__, array(__CLASS__, 'pageSettingsPlugin'));
     mgAddShortcode('slider-images', array(__CLASS__, 'handleShortCode'));
     self::$pluginName = PM::getFolderPlugin(__FILE__);
     self::$lang = PM::plugLocales(self::$pluginName);
     self::$path = PLUGIN_DIR . self::$pluginName;
     if (!URL::isSection('mg-admin')) {
         mgAddMeta('<link rel="stylesheet" href="' . SITE . '/' . self::$path . '/css/jquery.bxslider.css" type="text/css" />');
         mgAddMeta('<link rel="stylesheet" href="' . SITE . '/' . self::$path . '/css/slider-images-user.css" type="text/css" />');
         mgAddMeta('<script type="text/javascript" src="' . SITE . '/' . self::$path . '/js/jquery.bxslider.min.js"></script>');
         mgAddMeta('<script type="text/javascript" src="' . SITE . '/' . self::$path . '/js/slider-images-user.js"></script>');
     }
 }
 public function Contacts()
 {
     $SliderImages = SliderImages::all();
     return View::make('contacts.contacts')->with('slider', $SliderImages);
 }
 public function pricesearch()
 {
     $index = SliderImages::all();
     $country = Country::all();
     $city = City::all();
     $gallery = Gallery::all();
     $startdatae_search = strtotime(Input::get('startdatae_search'));
     $startdatae_search = date('Y-m-d H:i:s', $startdatae_search);
     $enddate_search = strtotime(Input::get('enddate_search'));
     $enddate_search = date('Y-m-d H:i:s', $enddate_search);
     $country_search = Input::get('country_search');
     $price_search_start = Input::get('price_search_start');
     $price_search_end = Input::get('price_search_end');
     if ($enddate_search == '1970-01-01 00:00:00') {
         $enddate_search = '2038-01-19 00:00:00';
     }
     if (empty($price_search_start)) {
         $price_search_start = '0';
     }
     if (empty($price_search_end)) {
         $res = DB::select(DB::raw('select max(price) as max_price from tours'));
         foreach ($res as $value) {
             $price_search_end = (int) $value->max_price + 1;
         }
     }
     $tours = new Tours();
     if ($startdatae_search != '1970-01-01 00:00:00') {
         $tours = $tours->where('start_date', '>', $startdatae_search);
     }
     if ($enddate_search != '1970-01-01 00:00:00') {
         $tours = $tours->where('end_date', '<', $enddate_search);
     }
     $tours = $tours->where('country', '=', $country_search);
     if (!empty($price_search_start)) {
         $tours = $tours->where('price', '>', $price_search_start);
     }
     if (!empty($price_search_end)) {
         $tours = $tours->where('price', '<', $price_search_end);
     }
     $tours = $tours->get();
     return View::make('main.search')->with('tours', $tours)->with('country', $country)->with('gallery', $gallery)->with('slider', $index);
 }