public function dologin() { $rules = array('username' => 'required', 'password' => 'required'); $message = array('required' => 'Data :attribute harus diisi', 'min' => 'Data :attribute minimal diisi :min karakter'); $validator = Validator::make(Input::all(), $rules, $message); if ($validator->fails()) { return Redirect::to('/')->withErrors($validator)->withInput(Input::except('password')); } else { $data = array('username' => Input::get('username'), 'password' => Input::get('password')); if (Auth::attempt($data)) { $data = DB::table('user')->select('user_id', 'level_user', 'username')->where('username', '=', Input::get('username'))->first(); //print_r($data); //echo $data->id_users; Session::put('user_id', $data->user_id); Session::put('level', $data->level_user); Session::put('username', $data->username); //print_r(Session::all()); return Redirect::to("/admin/beranda"); } else { Session::flash('messages', ' <div class="alert alert-danger alert-dismissable" > <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <strong>Peringatan...</strong><br> Username dan password belum terdaftar pada sistem ! </div> '); return Redirect::to('/')->withInput(Input::except('password')); } } }
/** * @covers $this->object->flash */ public function testFlash() { $this->object->flash('test', 'Trixie'); $this->object->flash('test', 'Tinkerbell'); $this->assertEquals('Tinkerbell', $this->object->flash('test')); $this->assertEquals(null, $this->object->flash('test')); }
public function postQuestion($id) { $note = 0; $qcm_student = []; $nb_choices = Choice::where('question_id', $id)->count(); for ($i = 0; $i < $nb_choices; $i++) { array_push($qcm_student, Input::get("status{$i}")); } $qcm_teacher = []; $choices = Choice::where('question_id', $id)->get(); foreach ($choices as $choice) { array_push($qcm_teacher, $choice->status); } for ($i = 0; $i < count($qcm_teacher); $i++) { if ($qcm_teacher[$i] == $qcm_student[$i]) { $note++; } } $test_score = DB::table('scores')->where('user_id', '=', Auth::user()->id)->where('question_id', '=', Question::where('id', $id)->first()->id)->first(); if (!is_null($test_score)) { //echo "fait"; Session::flash('message_error', 'Vous avez déjà fait ce QCM'); return Redirect::to('/student'); } else { $score = new Score(); $score->user_id = Auth::user()->id; $score->question_id = Question::where('id', $id)->first()->id; $score->status_question = 'fait'; $score->note = $note; $score->save(); Session::flash('message_success', 'Votre score a bien été enregistré'); return Redirect::to('/student'); } return Redirect::to('/student'); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { $this->validate($request, ['razonsocial' => 'required', 'numero' => 'required|unique:cuits,numero']); Cuit::create($request->all()); \Session::flash('message', 'Cuit added!'); return redirect('cuits'); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $att = new Attachment(); $att->unguard(); $att->fill(Input::only('title', 'description', 'hash', 'hash_algorithm', 'public')); if (!Input::hasFile('upload')) { Session::flash('message', ['content' => 'Geen bestand ontvangen.', 'class' => 'danger']); return View::make('attachments.create', ['attachment' => $att]); } if (!Input::file('upload')->isValid()) { Session::flash('message', ['content' => 'Ongeldig bestand ontvangen.', 'class' => 'danger']); return View::make('attachments.create', ['attachment' => $att]); } $file = Input::file('upload'); $name = $file->getClientOriginalName(); $extension = $file->getClientOriginalExtension(); $att->user_id = Auth::user()->id; $att->filename = $name; $att->extension = $extension; // We need to validate the attributes before moving the attachment into place if (!$att->validate()) { return View::make('attachments.create', ['attachment' => $att])->withErrors($att->validator()); } $file->move($att->folderPath(), $att->filename); $att->path = $att->folderPath(); $att->filesize = filesize($att->fullPath()); if (in_array($att->extension, Attachment::$image_extensions)) { $att->type = 'Image'; } $att->save(); return Redirect::to(route('attachments.show', [$att->id]))->with('message', ['content' => 'Bestand met succes geupload!', 'class' => 'success']); }
public function archive($publicId) { $branch = Branch::scope($publicId)->firstOrFail(); $branch->delete(); Session::flash('message', trans('texts.archived_branch')); return Redirect::to('company/branches'); }
/** * POST /register * * @return \View * @throws \Report\Managers\ValidationException */ public function register() { $manager = new RegisterManager($this->userRepo->newUser(), Input::all()); $manager->save(); Session::flash('message', 'register-sucess'); return Redirect::route('sing-in'); }
public function getPage($section = false, $page = false) { if ($section === false || $page === false) { return Redirect::to('/' . getLang()); } $this->loadQuestions(); if (!isset($this->quiz[$section]['pages']['page' . $page])) { return Redirect::to('/' . getLang()); } if ($section != 'demographics' && $this->screenersAnswered == false) { \Session::flash('flash_message', 'Please complete the "Demographics" section before continuing'); return Redirect::to('/quiz/demographics/' . $this->screenerToAnswer); } $data = $this->quiz[$section]; $sectionQuestions = $data['pages']['page' . $page]; $script = false; foreach ($sectionQuestions['questions'] as $number => $question) { if (isset($question['script'])) { $script[] = $question['script']; } } $currentLocal = App::getLocale(); $localQuestions = $currentLocal == 'en' ? '' : $currentLocal; $btnsize = '-small'; if ($localQuestions == 'es') { $btnsize = '-small lang'; } $vars = array('questions' => $sectionQuestions['questions'], 'heading' => Lang::get('general.title'), 'title' => $data['title'], 'report' => false, 'menu' => $this->menu, 'progress' => $this->totAnswered > 0 ? floor($this->totAnswered / $this->totQuestions * 100) : 0, 'colour' => $data['colour'], 'section' => $section, 'page' => $page, 'script' => $script, 'btnsize' => $btnsize); return View::make('question', $vars); //return $vars['questions']; //return $this->quiz; }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $account = new Account(); $account->setDomain(Input::get('domain')); $account->setNit(Input::get('nit')); $account->setName(Input::get('name')); $account->setEmail(Input::get('email')); // return $account->getErrorMessage(); if ($account->Guardar()) { //redireccionar con el mensaje a la siguiente vista Session::flash('mensaje', $account->getErrorMessage()); $direccion = "http://" . $account->domain . ".emizor.com"; //enviando correo de bienvenida global $correo; $correo = $account->getEmail(); // return Response::json($correo); Mail::send('emails.bienvenida', array('direccion' => $direccion, 'name' => $account->getName(), 'nit' => $account->getNit()), function ($message) { global $correo; $message->to($correo, '')->subject('Emizor'); }); // // $direccion = "/crear/sucursal"; return Redirect::to($direccion); } Session::flash('error', $account->getErrorMessage()); return Redirect::to('crear'); }
public function contactSend() { $data = ["nom" => Input::get('nom'), "prenom" => Input::get('prenom'), "email" => Input::get('email'), "message" => Input::get('message'), "sujet" => Input::get('sujet')]; $rules = array('email' => 'required', 'message' => 'required', 'sujet' => 'required'); $messages = array('required' => ':attribute est requis pour nous contacter', 'max' => "Le résumé de l'info trafic est trop long, 255 caractères max.", 'email' => "L'adresse email fournie n'est pas valide."); $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { $messages = $validator->messages(); return Redirect::to(URL::previous())->withErrors($validator); } else { $captcha_string = Input::get('g-recaptcha-response'); $captcha_response = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=6LcCwgATAAAAAKaXhPJOGPTBwX-n2-PPLZ7iupKj&response=' . $captcha_string); $captcha_json = json_decode($captcha_response); if ($captcha_json->success) { Mail::send('emails.contact', $data, function ($message) { $message->from('*****@*****.**', 'sujet du message'); $message->to('*****@*****.**', 'Linéa Gap')->subject('Sujet du message !'); }); Session::flash('flash_msg', "Message bien envoyé."); Session::flash('flash_type', "success"); return Redirect::to(URL::previous()); } else { Session::flash('flash_msg', "Champ de validation incorrect."); Session::flash('flash_type', "fail"); return Redirect::to(URL::previous()); } } }
public function postGeneral($id) { $id = Crypt::decrypt($id); $request = RRequest::find($id); if (Input::has('save')) { if (Input::get('employee') == 0 || Input::get('organization') == 0 || Input::get('r_plan') == 0 || Input::get('specialist') == 0 || strlen(Input::get('title')) < 2 || strlen(Input::get('description')) < 2) { Session::flash('sms_warn', trans('sta.require_field')); } else { $request->request_by_id = Input::get('employee'); $request->for_organization_id = Input::get('organization'); $request->for_planning_id = Input::get('r_plan'); $request->to_department_id = Input::get('specialist'); $request->request_title = Input::get('title'); $request->description = Input::get('description'); $request->request_date = date('Y-m-d'); $request->created_by = Auth::user()->employee_id; if ($request->save()) { Session::flash('sms_success', trans('sta.save_data_success')); //return Redirect::to('branch_request/general/' . Crypt::encrypt($request->id)); } } } $organizations = $this->array_list(Organization::list_item()); $employees = $this->array_list(Employee::list_item()); $department = $this->array_list(Department::list_item()); $r_plans = $this->array_list(Rplan::list_item()); return View::make('branch_request.edit_general', array('id' => $id, 'organizations' => $organizations, 'employees' => $employees, 'specialist' => $department, 'r_plans' => $r_plans, 'request' => $request)); }
public function getDelete($id) { $guest = guest::find($id); $guest->delete(); Session::flash('message', 'The records are deleted successfully'); return Redirect::to('guest'); }
/** * Store a newly created resource in storage. * POST /invoice * * @return Response */ public function store() { $validator = Validator::make(Input::all(), Invoice::$rules); if ($validator->fails()) { return Redirect::to('invoice')->withErrors($validator)->withInput(Input::all()); } else { $invoice = new Invoice(); $invoice->no_inv = Input::get('no_inv'); $invoice->tgl_inv = Input::get('tgl_inv'); $invoice->no_PO = Input::get('no_PO'); $invoice->ship_by = Input::get('ship_by'); $invoice->pay_method = Input::get('pay_method'); $invoice->no_rek = Input::get('no_rek'); $invoice->pelabuhan = Input::get('pelabuhan'); $invoice->carrier = Input::get('carrier'); $invoice->save(); $SPPB = Barang::join('detil_SPPB', 'barang.kode_barang', '=', 'detil_SPPB.kode_barang')->join('SPPB', 'detil_SPPB.no_SPPB', '=', 'SPPB.no_SPPB')->join('PO', 'SPPB.no_SPPB', '=', 'PO.no_SPPB')->where('no_PO', Input::get('no_PO'))->selectRaw('barang.kode_barang as barang, jml_pesan as pesan')->get(); foreach ($SPPB as $key => $value) { $barang = Barang::find($value->barang); $barang->jml_barang = $barang->jml_barang - $value->pesan; $barang->save(); } Session::flash('message', 'Successfully created invoice!'); return Redirect::to('invoice'); } }
public function destroy($id) { $ac = Activity::find($id); $ac->delete(); Session::flash('success', 'Data telah dihapus.'); return Redirect::to('/' . Auth::user()->role . '/activity'); }
public function destroy($id) { $bantek = Bantek::find($id); $bantek->delete(); Session::flash('success', 'Data telah dihapus'); return Redirect::to('admin/bantek'); }
public function getDelete($id) { $regions = Regions::find($id); $regions->delete(); Session::flash('message', 'The records are deleted successfully'); return Redirect::to('regions'); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $familia = Familia::findOrFail($id); $validator = Familia::validator(Input::all()); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $datos = Input::all(); if (Input::file('foto')) { $file = Input::file('foto'); $destinationPath = 'uploads/images/'; $filename = Str::random(20) . '.' . $file->getClientOriginalExtension(); $mimeType = $file->getMimeType(); $extension = $file->getClientOriginalExtension(); $upload_success = $file->move($destinationPath, $filename); if ($familia->foto != 'fam.jpg') { File::delete($destinationPath . $familia->foto); } $datos['foto'] = $filename; } else { unset($datos['foto']); } $familia->update($datos); Session::flash('message', 'Actualizado Correctamente'); Session::flash('class', 'success'); return Redirect::to('/dashboard/familia'); }
public function doSearch(SalesSearchRequest $request) { $productSales = []; $from = date('Y-m-d', strtotime($request->date_from)); $to = date('Y-m-d', strtotime($request->date_to)); $product = $request->product; $doctor = $request->doctor; $allSearchedReport = Report::select('id')->where('date', '>=', $from)->where('date', '<=', $to); if (!empty($MR)) { $allSearchedReport = $allSearchedReport->where('mr_id', \Auth::user()->id); } if (!empty($doctor)) { $allSearchedReport = $allSearchedReport->where('doctor_id', $doctor); } $searchResult = ReportSoldProduct::whereIn('report_id', $allSearchedReport->get()); if (!empty($product)) { $searchResult->where('product_id', $product); } foreach ($searchResult->get() as $singleResult) { if (isset($productSales[$singleResult->product->name])) { $productSales[$singleResult->product->name] += $singleResult->quantity; } else { $productSales[$singleResult->product->name] = $singleResult->quantity; } } $dataView = ['searchResult' => $productSales]; \Session::flash('date_from', $from); \Session::flash('date_to', $to); \Session::flash('productSales', $productSales); return view('mr.search.sales.result', $dataView); }
/** * Set status message * * @param string $message * @param string $type */ protected function setStatusMessage($message, $type = 'success') { if ($type == 'error') { $type = 'danger'; } \Session::flash('statusMessage', ['type' => $type, 'message' => $message]); }
/** * Execute the job. * * @return void */ public function handle(Request $request) { $gallery = Gallery::findOrFail($this->id); $gallery->update(['title' => $request->get('title')]); $gallery->SaveImageAttachments($request); \Session::flash('success', 'Your gallery has been saved successfully'); }
public function delete($id) { $asterisk = Asterisk::find($id); $asterisk->delete(); Session::flash('message', 'Asterisk Setting was deleted.'); return Redirect::to('/settings/asterisk'); }
/** * Show the application dashboard to the user. * * @return Response */ public function index() { if (\Auth::user()->status != 1) { \Session::flash('message', 'You are Blocked by Admin'); } return view('home'); }
/** * Log the user out of the application. * * @return \Illuminate\Http\Response */ public function getLogout() { \Auth::logout(); \Session::flash('flash_message', 'You are Logged Out.'); return redirect('/'); //return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/'); }
/** * Log the user out of the application. * * @return \Illuminate\Http\Response */ public function getLogout() { $user = \Auth::user()->name; \Auth::logout(); \Session::flash('flash_message', $user . ': You have been logged out.'); return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/'); }
public function insertBorrower($id) { $borrower_id = Auth::user()->student_id; $contract = Contract::where('contract_id', $id)->first(); $contract->borrower_id = $borrower_id; $contract->save(); $student = Student::where('student_id', $borrower_id)->first(); $data = array('email' => $student->email, 'first_name' => $student->first_name); Mail::send('emails.success', $data, function ($message) use($data) { $message->from('*****@*****.**', 'ShareBook'); $message->to($data['email']); $message->subject('Successfully Borrowed Textbook!'); }); $due_date = new DateTime($contract->due_date); $reminder_date = $due_date->modify('-1 Week'); $today = new DateTime("now"); $interval = $reminder_date->getTimestamp() - $today->getTimestamp(); Mail::later($interval, 'emails.reminder', $data, function ($message) use($data) { $message->from('*****@*****.**', 'ShareBook'); $message->to($data['email']); $message->subject('Due Date Reminder'); }); $book = Book::where('book_id', $contract->book_id); $book->delete(); \Session::flash('message', 'Successfully borrowed textbook!'); return view('index'); }
public function update($id) { $data = Setting::find($id); $data->email_sender = Input::get('email'); $data->protokol = Input::get('protokol'); $data->port = Input::get('port'); $data->host = Input::get('host'); $data->user_email = Input::get('user'); $data->pass_email = Input::get('pass'); $data->save(); if ($data->save()) { Session::flash('messages', ' <div class="alert alert-info alert-dismissable" id="notif"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <strong>Keterangan</strong><br> Setting berhasil disimpan </div> '); } else { Session::flash('messages', ' <div class="alert alert-danger alert-dismissable" id="notif"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <strong>Peringatan...</strong><br> Settig gagal disimpan </div> '); } return Redirect::to('admin/setting/email'); }
function do_save() { $ids = Input::get('ids'); $customer_first_name = Input::get('customer_first_name'); $customer_last_name = Input::get('customer_last_name'); $customer_company = Input::get('customer_company'); $customer_address = Input::get('customer_address'); $customer_town = Input::get('customer_town'); $customer_country = Input::get('customer_country'); $customer_email = Input::get('customer_email'); $customer_phone = Input::get('customer_phone'); $customer_datebirth = Input::get('customer_datebirth'); $customer_password = Input::get('password'); if ($customer_password != "") { $save['customer_password'] = $customer_password; } $save['customer_first_name'] = $customer_first_name; $save['customer_last_name'] = $customer_last_name; $save['customer_company'] = $customer_company; $save['customer_address'] = $customer_address; $save['customer_town'] = $customer_town; $save['customer_country'] = $customer_country; $save['customer_email'] = $customer_email; $save['customer_phone'] = $customer_phone; $save['customer_datebirth'] = $customer_datebirth; $this->customer->edit($ids, $save); Session::flash('notip', '<div class="alert alert-success">Profile telah diupdate</div>'); return Redirect::to('/member/' . $ids); }
public function delete($id) { $historia = Historia::find($id); $historia->delete(); Session::flash('message', 'Noticia Borrada'); return Redirect::back(); }
public function faqSend() { $question = new Question(); $input = Input::all(); $captcha_string = Input::get('g-recaptcha-response'); $captcha_response = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=6LcCwgATAAAAAKaXhPJOGPTBwX-n2-PPLZ7iupKj&response=' . $captcha_string); $captcha_json = json_decode($captcha_response); if ($captcha_json->success) { $rules = ["sujetQuestion" => "required", "mail" => "required|email", "contenuQuestion" => "required"]; $messages = ["required" => ":attribute est requis pour l'envoi d'une question", "email" => "L'adresse email précisée n'est pas valide"]; $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { $messages = $validator->messages(); Session::flash('flash_msg', "Certains champs spécifiés sont incorrects."); Session::flash('flash_type', "fail"); return Redirect::to(URL::previous())->withErrors($validator); } else { $question->fill($input)->save(); Session::flash('flash_msg', "Votre question nous est bien parvenue. Nous vous répondrons sous peu."); Session::flash('flash_type', "success"); return Redirect::to(URL::previous()); } } else { Session::flash('flash_msg', "Champ de vérification incorrect ou non coché."); Session::flash('flash_type', "fail"); return Redirect::to(URL::previous()); } }
public function postAdd() { $title = 'Proceso de entrega inmediata'; $cart = array(); $input = Input::all(); $idBranch = Auth::user()->roles()->first()->branch->id; if (Session::has('cart')) { $cart = Session::get('cart'); } if (empty($cart)) { return Redirect::to('instants'); } foreach ($cart as $item) { $check = Article::checkStock($item['article'], Auth::user()->roles()->first()->branch->id, $item['amount'], 'entrega inmediata'); /*Comprueba si hay suficiente stock en la sucursal*/ if ($check != 'Ok') { Session::flash('message', $check); return Redirect::to('cart'); } } /*Crea el registro en la tabla instants*/ self::saveInInstantTable(); /*Crea los registros en la tabla instant_items*/ foreach ($cart as $item) { self::saveInInstantItemTable($item['article']->id, $item['amount']); } #foreach $cart as $item /*Disminuye el campo stock en la tabla stocks*/ $instant_id = Instant::first()->orderBy('created_at', 'desc')->first()->id; self::saveInInstantStore($instant_id); /*Vacía el carrito*/ Session::forget('cart'); return Redirect::to('instants'); }