/** * Delete Videos * * @return bool */ public function deleteData($HomeSlides_id) { $validator = Validator::make(array('HomeSlides_id' => $HomeSlides_id), array('HomeSlides_id' => array('required'))); //dd($HomeSlides_id); // Validation did not pass if ($validator->fails()) { throw new Exception($validator->messages()); } try { $HomeSlides_id = HomeContents::findOrFail($HomeSlides_id); $HomeSlides_id->delete(); return true; } catch (Exception $ex) { return $ex; } }
</li>'; } $latestnews = '<span class="homesliderSmallname">Latest News</span> <ul class="bxslider garment-slider" id="lateestnews-slider"> ' . $liData . ' </div> <div class="col-xs-12 col-md-12 homeSliderBack ctrl"> <div class="garment-slider controls majorbuyer latestNewsctr"> <span class="arrow-left"> </span> <span class="arrow-right"> </span> </div> '; // Major Buyers ----------------------------------------------------------------------------- $homeSlides = HomeContents::where("type", "=", "majorNews")->get(); $liData = ''; foreach ($homeSlides as $value) { $liData = $liData . ' <li> <div class="row"> <div class="col-lg-12"> <img src="' . $value->image . '" height="220" class="img-responsive center-block"/> </div> </div> </li>'; } $majorbuyers = '<span class="homesliderSmallname">Clients</span><ul class="bxslider garment-slider" id="majorbuyers-slider"> ' . $liData . ' </div> <div class="col-xs-12 col-md-12 homeSliderBack ctrl"> <div class="garment-slider controls majorbuyer clientsctr">
public function postAddhomeContent() { $data = Input::only('desc', 'slidefile', 'position', 'updatedby', 'contenttype', 'title'); $file = Input::file('slidefile'); if ($file) { $name = $file->getClientOriginalName(); $extension = $file->getClientOriginalExtension(); $newfilename = uniqid(md5(rand(00, 9999) . $name)) . '.' . $extension; } $vidObj = new HomeContents(); // Garments Product if ($data['contenttype'] == 'garmentProduct') { $image = Image::make($_FILES['slidefile']['tmp_name'])->resize(345, 300)->save('uploads/' . $newfilename, 100); $update = $vidObj->add($data['contenttype'], $data['desc'], 'uploads/' . $newfilename, $data['updatedby'], $data['position'], ''); } // Under garmentProduct Product if ($data['contenttype'] == 'UndergarmentProduct') { $image = Image::make($_FILES['slidefile']['tmp_name'])->resize(345, 300)->save('uploads/' . $newfilename, 100); $update = $vidObj->add($data['contenttype'], $data['desc'], 'uploads/' . $newfilename, $data['updatedby'], $data['position'], ''); } // Latest News if ($data['contenttype'] == 'latestNews') { if ($_FILES['slidefile']['tmp_name']) { $image = Image::make($_FILES['slidefile']['tmp_name'])->resize(600, 250)->save('uploads/' . $newfilename, 100); $imageurl = 'uploads/' . $newfilename; } else { $imageurl = ''; } $update = $vidObj->add($data['contenttype'], $data['desc'], $imageurl, $data['updatedby'], $data['position'], $data['title']); //dd($update); $multimage = Input::file('filesToUpload'); $imgcounter = 0; if ($multimage) { foreach ($multimage as $file) { if ($file) { $name = $file->getClientOriginalName(); $extension = $file->getClientOriginalExtension(); $newfilename = uniqid(md5(rand(00, 9999) . $name)) . '.' . $extension; $image = Image::make($_FILES['filesToUpload']['tmp_name'][$imgcounter])->resize(700, 500)->save('uploads/' . $newfilename, 100); $newsGalobj = new newsGal(); $newsGalobj->name = 'uploads/' . $newfilename; $newsGalobj->position = '1'; $newsGalobj->news_id = $update->id; $newsGalobj->save(); //echo $newfilename.'<br>'; $imgcounter++; } } } } // Major News if ($data['contenttype'] == 'majorNews') { $image = Image::make($_FILES['slidefile']['tmp_name'])->resize(345, 300)->save('uploads/' . $newfilename, 100); $update = $vidObj->add($data['contenttype'], "", 'uploads/' . $newfilename, $data['updatedby'], $data['position'], ''); } //dd($data); if ($update) { $redirectTo = 'admin/homepage/garments-products'; if ($data['contenttype'] == 'garmentProduct') { $redirectTo = 'admin/homepage/garments-products'; } if ($data['contenttype'] == 'UndergarmentProduct') { $redirectTo = 'admin/homepage/under-garment-products'; } if ($data['contenttype'] == 'latestNews') { $redirectTo = 'admin/homepage/latest-news'; } if ($data['contenttype'] == 'majorNews') { $redirectTo = 'admin/homepage/major-news'; } return Redirect::to($redirectTo); } else { return Response::json(array('status' => '0', $data)); } }
<!--///////////////////////////////////////////////////////////////////////////////////////////////--> </div> <!-- header ends --> <!-- Main Content --> <div class="container-fluid vertical-center"> <div class="row"> <div class="col-xs-12 give-green-shade cht-push-left"> <h1 class="left-title mark-yellow">Latest News</h1> <ul class="list-unstyled chy-side-nav assign-scroll" style="text-align:left; height:70% !important; overflow:hidden; position: relative; padding-top:10px;"> <?php $getallNews = HomeContents::where("type", "=", "latestNews")->get(); foreach ($getallNews as $news) { $activelink = ''; if ($news->id == $data[0]->id) { $activelink = 'active'; } echo '<li><a href="/news/show/' . $news->id . '" style="color:#fff; padding-bottom:6px;clear:both; float:left;" class="galhover ' . $activelink . '">» ' . $news->title . '</a></li>'; } ?> </ul> </div> <div class="col-xs-12 give-green-shade cht-push-right">