/**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create(FiltroRequest $request)
 {
     // dd($request->input('menorEdad'));
     $cedula = trim($request->input('cedula'));
     if ($cedula) {
         $epa = DB::table('personas')->join('solicitudes', 'personas.id', '=', 'solicitudes.id_beneficiario')->join('usuarios_solicitudes', 'solicitudes.id', '=', 'usuarios_solicitudes.id_solicitud')->where('personas.cedula', $cedula)->orderBy('usuarios_solicitudes.estatus', 'desc')->get();
         if (count($epa) > 0) {
             if ($epa[0]->estatus == 1 || $epa[0]->estatus == 2) {
                 return redirect('filtro')->with('mensaje', 'la solicitud esta en en cola');
             } else {
                 $hoy = Carbon::now();
                 //agregamos 6 meses mas
                 $fecha_aprobada = Carbon::parse($epa[0]->fecha_registro)->addMonth(6);
                 //comprueba si la primera fecha es mayor a la segunda fecha.
                 $fecha = $hoy->gt($fecha_aprobada);
                 // Session::flash('mensaje','El beneficiario obtuvo un finaciamiento, debe esperar 6 meses');
                 //return redirect('filtro');
                 if ($fecha == true) {
                     $ci = Crypt::encrypt($cedula);
                     return redirect('solicitudes/' . $ci);
                 } else {
                     //dd(Redirect::action('SolicitudesController@show',$epa[0]->id));
                     //return redirect()->route('fichas',[$epa[0]->id]);
                     return Redirect::action('SolicitudesController@show', $epa[0]->id);
                 }
             }
         }
         $ci = Crypt::encrypt($cedula);
         return redirect('solicitudes/' . $ci);
     }
     //menor de edad sin cedula
     $ci = Crypt::encrypt(0);
     return redirect('solicitudes/' . $ci);
 }
 public function logar(Request $request)
 {
     $regras = array('email' => 'required|string', 'password' => 'required');
     $mensagens = array('required' => 'O campo :attribute deve ser preenchido.');
     $this->validate($request, $regras, $mensagens);
     $email = $request['email'];
     $senha = $request['password'];
     $condicao = ['email' => $email];
     $remember = !empty($request['remember']) ? true : false;
     if (Auth::attempt(['email' => $email, 'password' => $senha], $remember)) {
         if ($this->authorize('logar', $email, $senha)) {
             return Redirect::action('LoginController@index');
         }
     }
     //        if(!empty($usuario) && Hash::check($senha,$usuario->password))
     //        {
     //                Auth::loginUsingId($usuario->id);
     //
     //            if($this->authorize('logar',$email,$senha))
     //            {
     //                return redirect('Empresa');
     //            }
     //        }
     return redirect()->back()->withErrors('Usuário inválido.');
 }
Example #3
0
 /**
  * Update modified settings.
  *
  * @Post("/settings", middleware="shift.account", prefix="/")
  */
 public function update()
 {
     // TODO: Establish a method of validating settings?
     // ...
     $this->settingsService->update(Input::get());
     return Redirect::action('Tectonic\\Shift\\Controllers\\SettingController@index');
 }
 public function getConfirmEmail($token)
 {
     try {
         $email = Crypt::decrypt($token);
         $userQuery = DB::table('users')->where('email', $email);
         $user = $userQuery->first();
         if (isset($user)) {
             switch (\Config::get('app.registerMode')) {
                 case 'auto':
                     $userQuery->update(['active' => 1]);
                     Util::flash(trans('auth.confirmed'), '', Util::ALERT_SUCCESS);
                     // Foi enviado um email.
                     return view('auth/login');
                     break;
                 case 'confirm':
                     $userQuery->update(['pending' => 1]);
                     return view('info', ['title' => trans('auth.pending-approval_confirmation'), 'text' => trans('auth.pending-approval')]);
                     break;
             }
         } else {
             Util::flash(trans('auth.user'), '', Util::ALERT_ERROR);
         }
         // Não existe o email.
     } catch (Exception $e) {
         Util::flash(trans('auth.token'), '', Util::ALERT_ERROR);
         // Token inválido.
     }
     return Redirect::action(self::HOME_ACTION);
 }
 /**
  * Run the request filter.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @param  string  $role
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request->user()->role != 'client') {
         return Redirect::action('Auth\\AuthController@getLogin');
     }
     return $next($request);
 }
Example #6
0
 /**
  * Run the request filter.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @param  string  $role
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request->user()->role != 'admin' && $request->user()->role != 'user') {
         return Redirect::action('ClientController@index');
     }
     return $next($request);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CreateBookRequest $request)
 {
     $user = \Auth::User();
     if (!$user) {
         return view('auth.login')->withErrors('You are not loged in, please loged in !');
     }
     $book = $request->bookFillData();
     $book['user_id'] = $user->id;
     $book['published_at'] = Carbon::parse($request->get('published_at'))->format('Y-m-d');
     $fileSizeValidation = \Config::get('library.image_file_size');
     $newBook = Book::create($book);
     $newBook->syncAuthors($request->get('authors'));
     $this->manager->createDirectory($newBook->id);
     $file = $_FILES['image'];
     if ($file['size'] > 0) {
         // Additional image validation
         if (!starts_with($file['type'], 'image/')) {
             return Redirect::action('BookController@create')->withErrors('Invalid file format, please use image !');
         }
         $fileSize = $file['size'] / 1024;
         if ($fileSize > $fileSizeValidation) {
             return Redirect::action('BookController@create')->withErrors('The image may not be greater than ' . $fileSizeValidation . ' kilobytes. ');
         }
         $img = Image::make($_FILES['image']['tmp_name']);
         $img->resize(140, 140);
         $img->save('.' . \Config::get('library.uploads.webpath') . DIRECTORY_SEPARATOR . $newBook->id . '/cover.jpg');
     }
     return redirect::action('BookController@index')->withSuccess("The book with title '{$newBook->title}' was created.");
 }
 /**
  * Store a newly created report.
  *
  * @param Request $request
  * @return Response
  */
 public function store(Request $request)
 {
     if ($request['professor']['lattes']->isValid()) {
         $professor = new Professor($request['professor']);
         $professor->makeReport();
         return Redirect::action('ReportsController@show')->with('professor', $professor);
     }
 }
Example #9
0
 public function getShortlink($id)
 {
     $album = Album::find($id);
     if (!$album) {
         App::abort(404);
     }
     return Redirect::action('AlbumsController@getTrack', [$id, $album->slug]);
 }
Example #10
0
 public function getShortlink($id)
 {
     $playlist = Playlist::find($id);
     if (!$playlist || !$playlist->canView(Auth::user())) {
         App::abort(404);
     }
     return Redirect::action('PlaylistsController@getPlaylist', [$id, $playlist->slug]);
 }
 public function index()
 {
     if (Auth::user()->username != '1-0275071849') {
         $organization = Auth::user()->organization;
         return \View::make('home', ['organization' => $organization]);
     } else {
         return Redirect::action('InspectorController@index');
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, $this->rules);
     $input = Input::all();
     //		unset($input['_token']);
     $forum_post = ForumPost::create($input);
     //		Redirect::action('UserController@profile', array(1));
     return Redirect::action('ForumPostController@show', array($forum_post))->with('message', 'Forum created');
 }
 /**
  * Non Ajax Version
  */
 public function createNormal()
 {
     $imageableType = Input::get('imageable_type');
     $imageableId = Input::get('imageable_id');
     if (empty($imageableType) || empty($imageableId)) {
         return Redirect::action('AdminEventsController@index')->with('warning', 'Wrong Access');
     }
     $this->render('admin.photos.create-normal', compact('imageableType', 'imageableId'));
 }
Example #14
0
 public function documentUpdate(Request $request, $id)
 {
     $document = \App\Models\Document::find($id);
     $document->document_date = Input::get('document_date');
     $document->actual_date = Input::get('actual_date');
     $document->save();
     $user = \App\Models\User::find($document->user_id);
     return Redirect::action('AdminController@organization', [$user->organization_id]);
 }
Example #15
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     dd($request['products']);
     $products = $request['products'];
     $user_id = \Auth::user()->id;
     $this->validate($request, ['street2' => 'required|max:255|string', 'house_nr2' => 'required|max:255|string', 'postalcode2' => 'required|max:255|string', 'city2' => 'required|max:255|string']);
     \App\User::query()->where('id', $user_id)->update(array('street2' => $request['street2'], 'house_nr2' => $request['house_nr2'], 'postalcode2' => $request['postalcode2'], 'city2' => $request['city2']));
     return Redirect::action('PagesController@pay', compact('products'));
 }
Example #16
0
 public function update($id, UserRequest $request)
 {
     $user = User::findOrFail($id);
     $groups = array_filter(array_flatten([$request->input('primary_group'), $request->input('secondary_group')]));
     $updateData = ['email' => $request->input('email'), 'password' => bcrypt($request->input('password'))];
     $user->update($updateData);
     $user->groups()->sync($groups);
     return Redirect::action('UserController@index');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function postCreate(QuestionRequest $request)
 {
     $question = new Question();
     $question->user_id = Auth::id();
     $question->country_id = Auth::user()->country_id;
     $question->question_category_id = $request->question_category_id;
     $question->content = $request->content;
     $question->save();
     return Redirect::action('HomeController@index');
 }
Example #18
0
 public function store($id)
 {
     $data = Request::all();
     $user_id = Auth::user()->id;
     $post = Post::find($id);
     $comment = $post->comments()->create(array('user_id' => $user_id, 'body' => Request::get('body')));
     if ($comment->save()) {
         $post = $comment->commentable()->first();
         return Redirect::action('PostsController@show', ['id' => $post->id]);
     }
 }
 public function update(Request $request, $id)
 {
     $depreciation = \App\Models\Depreciation::find($id);
     $depreciation->name = $request->name;
     $depreciation->number = $request->number;
     $depreciation->carrying_amount = $request->carrying_amount;
     $depreciation->sum = $request->sum;
     $depreciation->residual_value = $request->residual_value;
     $depreciation->save();
     return Redirect::action('ReportController@depreciation', $depreciation->report_id);
 }
Example #20
0
 public function destroy($id)
 {
     $result = CourseComponent::deleteCourse($id);
     $message = $result['message'];
     $status = $result['status'];
     //Отправим на заглавную страницу всех курсов
     //после редиректа от функции удаления.
     //Тогда у нас есть некое статусное сообщение($message),
     //которое необходимо отрисовать на странице.
     return Redirect::action('CourseController@index')->with('message', $message)->with('status', $status);
 }
 public function destroy($id)
 {
     $UnitGroup = UnitGroups::findOrFail($id);
     if ($UnitGroup->disable_delete) {
         Session::flash('flash_message', 'This ' . $this->title . ' is not deletable!');
     } else {
         $UnitGroup->delete();
         Helper::add($id, 'deleted unit group ' . $UnitGroup->title . ' (ID ' . $id . ')');
         Session::flash('flash_message', $this->title . ' successfully deleted!');
     }
     return Redirect::action('UnitGroupsController@index');
 }
 /**
  * @param $id
  * @return \Illuminate\Http\RedirectResponse
  * Update Profile
  */
 public function update($id)
 {
     $this->userRepository->findById($id);
     $val = $this->userRepository->getEditForm($id);
     if (!$val->isValid()) {
         return Redirect::back()->with('errors', $val->getErrors())->withInput();
     }
     if (!$this->userRepository->update($id, $val->getInputData())) {
         return Redirect::back()->with('errors', $this->userRepository->errors())->withInput();
     }
     return Redirect::action('UserController@getProfile', $id)->with('success', 'word.saved');
 }
Example #23
0
 public function index()
 {
     if (\Gate::allows('admin-check')) {
         $matches = $this->getMatches('A');
         $matches16 = $this->getMatches('B');
         $matches8 = $this->getMatches('C');
         $matches4 = $this->getMatches('D');
         $matches2 = $this->getMatches('E');
         $countrydropdown = $this->CountryDropdown();
         return view('Admin.index', ['matches' => $matches, 'matches16' => $matches16, 'matches8' => $matches8, 'matches4' => $matches4, 'matches2' => $matches2, 'countrydropdown' => $countrydropdown]);
     } else {
         return Redirect::action('HomeController@index');
     }
 }
Example #24
0
 public function index()
 {
     if (!\Gate::allows('admin-check')) {
         $matches = $this->getMatches('A');
         $matches16 = $this->getMatches('B');
         $matches8 = $this->getMatches('C');
         $matches4 = $this->getMatches('D');
         $matches2 = $this->getMatches('E');
         $ownscore = new ScoreClass();
         $totalscore = $ownscore->Scores(Auth::user()->id);
         return view('Game.index', ['matches' => $matches, 'matches16' => $matches16, 'matches8' => $matches8, 'matches4' => $matches4, 'matches2' => $matches2, 'totalscore' => $totalscore]);
     } else {
         return Redirect::action('AdminController@index');
     }
 }
 public function calendarevents(Request $request)
 {
     $json = json_encode($request->only('fechas'));
     $json = substr($json, 10, -1);
     $json1 = json_decode($json);
     $json2 = json_decode($json1);
     $this->arrayEventos = $json2;
     $n = count($json2);
     Event::where('user_id', '=', Auth::user()->id)->delete();
     for ($i = 0; $i < $n; $i++) {
         $json2[$i]->start = substr($json2[$i]->start, 0, -5);
         if ($json2[$i]->backcolor != 'white') {
             Event::create(['titulo_evento' => $json2[$i]->titulo, 'start' => $json2[$i]->start, 'backgroundColor' => $json2[$i]->backcolor, 'borderColor' => $json2[$i]->bordecolor, 'allDay' => $json2[$i]->allday, 'id_eventoCallendar' => $json2[$i]->id, 'user_id' => Auth::user()->id]);
         }
     }
     return Redirect::action('Calendar\\FullCalendarController@getCalendar');
 }
Example #26
0
 public function filter(\Illuminate\Routing\Route $route, $request)
 {
     $user = AuthModel::user();
     if (null == $user) {
         //用户未登录
         return Redirect::action($this->login_page);
     } else {
         //用户已登录,检查权限
         if (false == $this->rightsFilter($user, $route)) {
             return Redirect::action($this->forbidden_page);
         } else {
             //检查是否锁屏
             $as = Route::current()->getName();
             if (Session::get('admin_lock_url') && !in_array($as, ['admin.logout', 'admin.lock', 'admin.unlock'])) {
                 return Redirect::action('admin.lock');
             }
         }
     }
 }
 public function destroy($id)
 {
     $ItemCategories = ItemCategories::findOrFail($id);
     $items = Items::where(['category_id' => $id])->get();
     Helper::add($id, 'deleted items category ' . $ItemCategories->title);
     if (count($items) > 0) {
         $category = ItemCategories::where(['title' => 'Uncategorized'])->first();
         if (!$category) {
             $category = ItemCategories::create(['title' => 'Uncategorized']);
         }
         Items::where(['category_id' => $id])->update(['category_id' => $category->id]);
     }
     if ($ItemCategories->title == 'Uncategorized' && count($items) > 0) {
     } else {
         $ItemCategories->delete();
     }
     Session::flash('flash_message', $this->title . ' successfully deleted!');
     return Redirect::action('ItemCategoriesController@index');
 }
Example #28
0
 public function store($id)
 {
     $organization = \App\Models\Organization::find($id);
     $reports = $organization->reports;
     if ($reports->count()) {
         $maxYear = \App\Models\Report::where('organization_id', '=', $id)->max('year');
         $maxQuarter = \App\Models\Report::where('organization_id', '=', $id)->where('year', '=', $maxYear)->max('quarter');
         if ($maxQuarter == 4) {
             $year = ++$maxYear;
             $report = new \App\Models\Report();
             $report->year = $year;
             $report->quarter = 1;
             $report->organization_id = $id;
             $report->state = 'not_accepted';
             $report->save();
             return Redirect::action('AdminController@organization', [$id]);
         } else {
             $quarter = $maxQuarter + 1;
             $report = new \App\Models\Report();
             $report->year = $maxYear;
             $report->quarter = $quarter;
             $report->organization_id = $id;
             $report->state = 'not_accepted';
             $report->save();
             return Redirect::action('AdminController@organization', [$id]);
         }
     } else {
         $report = new \App\Models\Report();
         $report->year = 2015;
         $report->quarter = 1;
         $report->organization_id = $id;
         $report->state = 'not_accepted';
         $report->save();
         return Redirect::action('AdminController@organization', [$id]);
     }
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $id = $request->get('ordine');
     $codice = $request->get('vettura');
     $stato = $request->get('stato');
     $stato = $this->stato->find($stato);
     $this->ordine->find($id)->stati()->save($stato);
     $vettura = $this->vettura->where('ordine', '=', $id)->first();
     if ($codice == null || trim($codice) == "") {
         if ($vettura != null) {
             $vettura->trash();
         }
         return Redirect::action('OrdiniController@index');
     }
     $data = array('ordine' => $id, 'vettura' => $codice);
     if ($this->vettura->validate($data)) {
         if ($vettura != null) {
             $vettura->edit($data);
         } else {
             $this->vettura->store($data);
         }
         return Redirect::action('OrdiniController@index');
     } else {
         $errors = $this->vettura->getErrors();
         return Redirect::action('OrdiniController@edit', [$id])->withInput()->withErrors($errors);
     }
 }
Example #30
0
 /**
  * @return mixed
  */
 public function onFailure()
 {
     return Redirect::action(AuthenticationController::class . '@login');
 }