public function getIndex($lang = 'id') { $work = GeneralInfo::Key('work-speaker-summary')->first(); $data['work'] = $work->value_id; if ($lang == 'en') { $data['work'] = $work->value_en; } $customer = GeneralInfo::Key('work-entertainer-summary')->first(); $data['customer'] = $customer->value_id; if ($lang == 'en') { $data['customer'] = $customer->value_en; } $data['clients'] = Client::Speaker()->orderByRaw("RAND()")->take(5)->get(); $testimony = Testimony::select('content_id as content', 'name', 'position', 'photo'); if ($lang == 'en') { $testimony = Testimony::select('content_en as content', 'name', 'position', 'photo'); } $data['testimony'] = $testimony->Speaker()->Featured()->orderByRaw("RAND()")->take(4)->get(); $data['imaji'] = Imaji::orderByRaw("RAND()")->take(4)->get(); $link['client'] = URL::route('site.speaker.client', array('lang' => Request::segment(1))); $link['customer'] = URL::route('site.speaker.customer', array('lang' => Request::segment(1))); $link['work'] = URL::route('site.speaker.work', array('lang' => Request::segment(1))); $data['link'] = $link; $data['pageTitle'] = "Corporate Speaker - Beranda"; $data['pageDescription'] = "Corporate Speaker - Beranda"; if ($lang == 'en') { $data['pageTitle'] = "Corporate Speaker - Home"; $data['pageDescription'] = "Corporate Speaker - Home"; } $promo['promoPopup'] = getPromoPopupData($lang); $data['promoPopup'] = $promo; $data['pageType'] = 'corporate-speaker'; return View::make('pages.home', $data); }
public function postDelete() { if (Input::has('id')) { DB::transaction(function () { $imaji = Imaji::find(Input::get('id')); if (!empty($imaji->image)) { File::delete($imaji->image); } if (!empty($imaji->thumbnail)) { File::delete($imaji->thumbnail); } Imaji::destroy(Input::get('id')); echo "1"; }); } else { echo "0"; } }