public function postLogin() { $data = Input::only('email', 'password'); $userObj = new User(); $login = $userObj->loginUser($data['email'], $data['password']); if ($login) { // Filter will take the decision $homeSlides = HomeSlides::get(); return View::make('backend.homeSlidelist')->with('homeSlides', $homeSlides); //return Response::json(array('status' => '1',array('user' => $login->toArray()))); } }
public function postUpdateSlide() { $data = Input::only('title', 'desc', 'slidefile', 'position', 'updatedby', 'slideID'); $file = Input::file('slidefile'); if ($file) { $name = $file->getClientOriginalName(); $extension = $file->getClientOriginalExtension(); $newfilename = uniqid(md5(rand(00, 9999) . $name)) . '.' . $extension; $image = Image::make($_FILES['slidefile']['tmp_name'])->resize(1440, 900)->save('uploads/' . $newfilename); $vidObj = new HomeSlides(); $update = $vidObj->updateData($data['title'], $data['desc'], 'uploads/' . $newfilename, $data['updatedby'], $data['position'], $data['slideID']); } else { $vidObj = new HomeSlides(); $update = $vidObj->updateData($data['title'], $data['desc'], '', $data['updatedby'], $data['position'], $data['slideID']); } if ($update) { return Redirect::to('admin/homeslide/list'); //return Response::json(array('status' => '1',$data)); } else { return Response::json(array('status' => '0', $data)); } }
$update = $scObj->deleteData($id); return Redirect::to($redirectTo); }); // ------------------------------------------------------------------------------ # Admin Status Change Video; Route::get('/status/{status}/{id}', function ($status, $id) { $user = Sentry::getUser(); $scObj = new HomeSlides(); $update = $scObj->changeStatus($id, $status, $user->id); $videos = HomeSlides::get(); return View::make('backend.homeSlidelist')->with('homeSlides', $videos); }); # Admin Delete Video; Route::get('/delete/{id}', function ($id) { $user = Sentry::getUser(); $scObj = new HomeSlides(); $update = $scObj->deleteData($id); $videos = HomeSlides::get(); return View::make('backend.homeSlidelist')->with('homeSlides', $videos); }); }); /* |-------------------------------------------------------------------------- | Front-end API Routes |-------------------------------------------------------------------------- */ # Authentication API Route::controller('auth', 'RainAuthController'); # Send Mail; Route::post('/sendcontact', function () { $name = Input::get('name');
/** * Delete Videos * * @return bool */ public function deleteData($HomeSlides_id) { $validator = Validator::make(array('HomeSlides_id' => $HomeSlides_id), array('HomeSlides_id' => array('required'))); // Validation did not pass if ($validator->fails()) { throw new Exception($validator->messages()); } try { $HomeSlides_id = HomeSlides::findOrFail($HomeSlides_id); $HomeSlides_id->delete(); return true; } catch (Exception $ex) { return $ex; } }