本文整理汇总了PHP中Input::flash方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::flash方法的具体用法?PHP Input::flash怎么用?PHP Input::flash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input::flash方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_nuevo
public function post_nuevo()
{
$inputs = Input::all();
$reglas = array('localidad' => 'required|max:50');
$mensajes = array('required' => 'Campo Obligatorio');
$validar = Validator::make($inputs, $reglas);
if ($validar->fails()) {
Input::flash();
return Redirect::back()->withInput()->withErrors($validar);
} else {
$localidad = new Localidad();
$localidad->localidad = Input::get('localidad');
$localidad->save();
return Redirect::to('lista_localidades')->with('error', 'La Localidad ha sido registrada con Éxito')->withInput();
}
}
示例2: update
public function update()
{
$inputs = Input::all();
$reglas = array('sucursal' => 'required', 'stock' => 'required|integer');
$mensajes = array('required' => 'Campo Obligatorio');
$validar = Validator::make($inputs, $reglas);
if ($validar->fails()) {
Input::flash();
return Redirect::back()->withInput()->withErrors($validar);
} else {
$id_articulo = Input::get('id_articulo');
$id_sucursal = Input::get('sucursal');
$stock = Input::get('stock');
$p = DB::table('stock')->where('id_articulo', $id_articulo)->where('id_sucursal', $id_sucursal)->first();
if (empty($p)) {
DB::table('stock')->insert(array('id_articulo' => $id_articulo, 'id_sucursal' => $id_sucursal, 'cantidad' => $stock));
} else {
DB::table('stock')->where('id_articulo', $id_articulo)->where('id_sucursal', $id_sucursal)->update(array('cantidad' => $stock));
}
$sucursales = Sucursal::all();
$articulo_id = $id_articulo;
$articulos = DB::table('articulos')->join('stock', 'articulos.id_articulo', '=', 'stock.id_articulo')->join('sucursales', 'stock.id_sucursal', '=', 'sucursales.id_sucursal')->select('articulos.id_articulo', 'articulos.nombre', 'sucursales.nombre as sucursal', 'stock.cantidad')->get();
return View::make('edit_stock')->with('ok', 'El Stock se ha actualizado con éxito')->with('sucursales', $sucursales)->with('articulo_id', $articulo_id)->with('articulos', $articulos);
}
}
示例3: requestLogin
/**
* Display the specified resource.
*
* @param NA
* @return NA
*/
public function requestLogin()
{
// validate the info, create rules for the inputs
$rules = array('user_email' => 'required|email', 'password' => 'required|min:4');
// run the validation rules on the inputs from the form
$validator = Validator::make(Input::all(), $rules);
// if the validator fails, redirect back to the form
if ($validator->fails()) {
return Redirect::to(URL::previous())->withErrors($validator)->withInput(Input::except('password'));
// send back the input (not the password) so that we can repopulate the form
} else {
// create our user data for the authentication
$user_array = array('user_email' => $this->getInput('user_email', ''), 'password' => $this->getInput('password', ''));
// attempt to do the login
if (Auth::attempt($user_array)) {
$current_password = $this->getInput('password', '');
// additional validation to make sure that password matched
$user = Auth::user();
if (Hash::check($current_password, $user->password)) {
return Redirect::intended('check');
}
} else {
Input::flash();
Session::flash('error_message', 'Invalid email or password, please try again');
$this->data['has_error'] = ERROR;
return View::make('session.login')->with('data', $this->data);
}
}
}
示例4: post_edit
public function post_edit()
{
if (!cmsHelper::isCurrentUserAllowedToPerform('comments')) {
return;
}
//Flash current values to session
Input::flash();
$id = Input::get('editingMode');
$editComment = Comment::find($id);
$editComment->name = Input::get('name');
$editComment->email = Input::get('email');
$editComment->content = Input::get('content');
//Add rules here
$rules = array('name' => 'required', 'email' => 'required', 'content' => 'required');
//Get all inputs fields
$input = Input::all();
//Apply validaiton rules
$validation = Validator::make($input, $rules);
//Validate rules
if ($validation->fails()) {
return Redirect::to($_SERVER['PATH_INFO'] . '?id=' . $editComment->id)->with_errors($validation);
}
//Update the comment
$editComment->save();
return Redirect::to($_SERVER['PATH_INFO'] . '?id=' . $editComment->id)->with('successmessage', 'Comment successfully updated');
}
示例5: crearProyecto
public function crearProyecto()
{
$data = Input::all();
$ciclo = $data['cicle'];
$ciclo == 1 ? $ciclo = 'Agosto-Enero' : ($ciclo = 'Enero-Julio');
//Valida los datos ingresados.
$notificaciones = ['year.required' => '¡Escriba un año!', 'year.numeric' => '¡El año debe ser numérico!'];
$validation = Validator::make($data, ['year' => 'required|numeric'], $notificaciones);
if ($validation->passes()) {
//Se revisa si había registros antes
$temp = Proyecto::select('ciclo', 'anio')->where('ciclo', $ciclo)->where('anio', $data['year'])->get();
//Si aún no había registros, se añaden las horas disponbiles por aula y día.
if (sizeof($temp) < 1) {
$idProyecto = Proyecto::insertGetId(['ciclo' => $ciclo, 'anio' => $data['year']]);
$aulas = Aula::count();
$horas = Hora::select('*')->where('id', '>', '0')->get();
for ($i = 2; $i <= $aulas; $i++) {
for ($k = 0; $k < 5; $k++) {
foreach ($horas as $hora) {
$temp = new Disponible();
$temp->id_aula = $i;
$temp->hora = $hora['id'];
$temp->dia = $k;
$temp->id_proyecto = $idProyecto;
$temp->save();
}
}
}
}
return Redirect::to('/proyectos/');
} else {
Input::flash();
return Redirect::to('/proyectos/editar-proyecto')->withInput()->withErrors($validation);
}
}
示例6: update
public function update()
{
$validator = Validator::make(Input::all(), array('schoolname' => 'required|min:3|max:256', 'schoolnameabbr' => 'required|alpha|min:2|max:10', 'schooladdress' => 'required|min:4|max:512', 'logo' => 'required', 'adminsitename' => 'required|min:2|max:256', 'systemurl' => 'required|url', 'url' => 'url|required', 'cache' => "required|integer"));
if ($validator->fails()) {
Input::flash();
return Redirect::to('/settings')->withErrors($validator);
}
$schoolname = Input::get('schoolname');
Setting::set('system.schoolname', $schoolname);
Setting::set('system.schoolnameabbr', Input::get('schoolnameabbr'));
Setting::set('system.schooladdress', Input::get('schooladdress'));
Setting::set('system.logo_src', Input::get('logo'));
Setting::set('system.adminsitename', Input::get('adminsitename'));
Setting::set('app.url', Input::get('url'));
Setting::set('app.captcha', Input::get('captcha'));
Setting::set('system.dashurl', Input::get('systemurl'));
Setting::set('system.dashurlshort', Input::get('systemurlshort'));
Setting::set('system.siteurlshort', Input::get('siteurlshort'));
Setting::set('system.cache', Input::get('cache'));
$theme = Theme::uses('dashboard')->layout('default');
$view = array('name' => 'Dashboard Settings');
$theme->breadcrumb()->add([['label' => 'Dashboard', 'url' => Setting::get('system.dashurl')], ['label' => 'Dashboard', 'url' => Setting::get('system.dashurl') . '/settings']]);
$theme->appendTitle(' - Settings');
return $theme->scope('settings', $view)->render();
}
示例7: update
public function update($dash, $id)
{
if ($id == 0) {
$validator = Validator::make(Input::all(), array('title' => 'required|min:3|max:256', 'description' => 'max:1024', 'tutorial' => 'required'));
$messages = array('required' => 'The :attribute field is required.');
if ($validator->fails()) {
Input::flash();
return Redirect::to('tutorial/edit/' . $id)->withErrors($validator)->with('input', Input::get('published'));
} else {
if (Sentry::getUser()->inGroup(Sentry::findGroupByName('teachers'))) {
$newid = self::createtutorial($id);
Cache::forget("tutorial_listing_dash" . Sentry::getUser()->id);
return Redirect::to('/tutorial/edit/' . $newid . '');
}
Input::flash();
// Log::error(Input::get('subject'));
return Redirect::to('/tutorial/edit/' . $id . '');
}
} else {
$validator = Validator::make(Input::all(), array('title' => 'required|min:3|max:256', 'description' => 'required|max:1024', 'tutorial' => 'required'));
$messages = array('required' => 'The :attribute field is required.');
if ($validator->fails()) {
Input::flash();
return Redirect::to('/tutorial/edit/' . $id . '')->withErrors($validator);
} else {
$tutorialcheck = Tutorials::find($id);
if ($tutorialcheck->createdby == Sentry::getUser()->id || Sentry::getUser()->inGroup(Sentry::findGroupByName('admin'))) {
self::updatetutorial($id);
return Redirect::to('/tutorial/edit/' . $id . '');
}
return Redirect::to("/");
}
}
}
示例8: search
public function search()
{
$query_supplier = '%' . Input::get('supplier') . '%';
$query_metal = '%' . Input::get('metal') . '%';
$query_city = '%' . Input::get('city') . '%';
$query_grade_a = '%' . Input::get('grade_a') . '%';
$query_grade_b = '%' . Input::get('grade_b') . '%';
$query_thickness = '%' . Input::get('thickness') . '%';
$query_shape = '%' . Input::get('shape') . '%';
if (Input::has('volume_from')) {
$query_volume_from = Input::get('volume_from');
} else {
$query_volume_from = 0;
}
if (Input::has('volume_to')) {
$query_volume_to = Input::get('volume_to');
} else {
$query_volume_to = Product::max('volume');
}
if (Input::has('date_from')) {
$query_date_from = date('Y-m-d H:i:s', strtotime(Input::get('date_from')));
} else {
$query_date_from = date('Y-m-d H:i:s', strtotime("1-1-1970"));
}
if (Input::has('date_to')) {
$query_date_to = date('Y-m-d H:i:s', strtotime(Input::get('date_to') . " 23:59"));
} else {
$query_date_to = date('Y-m-d H:i:s', strtotime("now"));
}
$products = Product::where('supplier', 'LIKE', $query_supplier)->where('metal', 'LIKE', $query_metal)->where('city', 'LIKE', $query_city)->where('grade_a', 'LIKE', $query_grade_a)->where('grade_b', 'LIKE', $query_grade_b)->where('thickness', 'LIKE', $query_thickness)->where('shape', 'LIKE', $query_shape)->whereBetween('created_at', array($query_date_from, $query_date_to))->whereBetween('volume', array($query_volume_from, $query_volume_to))->paginate(5);
$suppliers = Product::lists('supplier', 'supplier');
$metals = Product::lists('metal', 'metal');
return View::make('products.list')->with('products', $products)->with('suppliers', $suppliers)->with('metals', $metals)->withInput(Input::flash());
}
示例9: addTask
public function addTask()
{
if ($_POST) {
// Lets start validation
// validate input
$rules = array('name' => 'required|max:50', 'description' => 'required', 'didyouknow' => 'required', 'reference' => 'required');
$validation = Validator::make(Input::all(), $rules);
if ($validation->fails()) {
Input::flash();
return Redirect::back()->withInput()->withErrors($validation);
}
$task = new Task();
$task->name = Input::get('name');
$task->description = Input::get('description');
$task->didyouknow = Input::get('didyouknow');
$task->reference = Input::get('reference');
$task->author = Input::get('taskauthor');
$task->createdby = 0;
$task->suspended = 0;
$task->number = 0;
$task->save();
return Redirect::to('tasks/manage');
}
return View::make('task.add');
}
示例10: validate
public function validate($input = null, $rules = null, $messages = null)
{
if (is_null($input)) {
$input = Input::all();
}
if (is_null($rules)) {
$rules = $this->getRules();
}
if (is_null($messages)) {
$messages = $this->getMessages();
}
$v = Validator::make($input, $rules, $messages);
if ($v->passes()) {
return true;
} else {
Input::flash();
foreach ($input as $key => $value) {
$error = $v->messages()->get($key);
if ($error) {
$this->validationMessages[$key] = $error;
}
}
$this->error = $v->errors();
return false;
}
}
示例11: create
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
if (\Input::get('month')) {
$data = \Input::all();
$date = $data['year'] . '-' . $data['month'] . '-01';
$emp_type = $data['emp_type'];
$client = \Input::get('clientId');
$payType = \Input::get('payType');
$empId = \Input::get('empId');
if ($emp_type == 'inhouse') {
$uId = \Auth::user()->id;
$emp = \User::whereHas('empJobDetail', function ($q) use($uId, $date) {
$q->where('emp_type', '=', 'inhouse');
$q->whereHas('branch', function ($s) use($uId) {
$s->where('branch_id', '=', $uId);
});
$q->whereHas('attend', function ($a) use($date) {
$a->where('attend_date', '=', $date);
});
})->paginate(20);
} elseif ($emp_type == 'outsource' && $client != '') {
$emp = \User::whereHas('empJobDetail', function ($q) use($client, $date) {
$q->whereHas('attend', function ($a) use($date) {
$a->where('attend_date', '=', $date);
});
$q->where('emp_type', '=', 'outsource');
$q->where('client_id', '=', $client);
})->paginate(20);
}
return \View::make('branch/salary.manage_salary')->with('emp', $emp)->with('date', $date)->with(\Input::flash());
} else {
return \View::make('branch/salary.manage_salary');
}
}
示例12: NuevaTarea
public function NuevaTarea()
{
$enviado = Input::get('enviado');
if (isset($enviado)) {
$rules = $this->getRulesNuevaTarea();
$messages = $this->getMensajesNuevaTarea();
$validator = Validator::make(Input::All(), $rules, $messages);
if ($validator->passes()) {
$insert = $this->InsertarTarea(Input::all());
if ($insert === 1) {
$mensaje = 'Tarea Creada con Éxito';
$visible = false;
} else {
}
return Redirect::route('listatareas')->withInput(Input::flash());
} else {
Session::flash('visibleNuevo', TRUE);
return Redirect::route('listatareas')->withInput(Input::flash())->withErrors($validator);
}
} else {
Session::flash('mensajeError', $mensajeError);
Session::flash('visibleNuevo', TRUE);
return Redirect::route('listatareas');
}
}
示例13: update
public function update()
{
$inputs = Input::all();
$reglas = array('first_name' => 'required|min:4', 'last_name' => 'required', 'email' => 'email', 'username' => 'required', 'password' => 'required|min:5|max:20', 'confirmar_clave' => 'required|same:password');
$mensajes = array('required' => 'Campo Obligatorio');
$validar = Validator::make($inputs, $reglas);
if ($validar->fails()) {
Input::flash();
return Redirect::back()->withInput()->withErrors($validar);
} else {
$id_user = Input::get('id');
$user = User::find($id_user);
$clave = Input::get('password');
$user->first_name = Input::get('first_name');
$user->last_name = Input::get('last_name');
$user->email = Input::get('email');
$user->username = Input::get('username');
$user->password = Hash::make($clave);
$user->tipo_usuario = Input::get('tipo_usuario');
$user->save();
return Redirect::to('lista_usuarios')->with('error', 'El usuario ha sido actualizado con Éxito')->withInput();
//$users = User::all();
//return View::make('lista_usuarios')->with('users', $users);
}
}
示例14: action_index
public function action_index($modelName)
{
$model = $this->getClassObject($modelName);
$columnModel = $model::first();
Input::flash();
if (Input::get($modelName) != null && $this->addConditions($model, $modelName)->first() != null) {
$columnModel = $this->addConditions($model, $modelName)->first();
}
if ($columnModel == null) {
return Redirect::to("/lara_admin/models/{$modelName}/new");
}
$columns = $columnModel->columns();
$sort_options = $this->setOrderOptions($columns);
$models = $this->addConditions($model, $modelName)->order_by($sort_options["column_order"], $sort_options["sort_direction"])->paginate($model->perPage);
$request_uri = Request::server("REQUEST_URI");
$request_uri = preg_replace("/&order=[^&]*/", "", $request_uri);
if (!preg_match("/\\?/i", Request::server("REQUEST_URI"))) {
$request_uri .= "?";
}
//TODO function getCustomAction
$name_custom_action = "lara_admin::" . Str::plural(Str::lower($modelName)) . "." . preg_replace("/action_/", "", __FUNCTION__);
if (View::exists($name_custom_action) != false) {
$view = View::make($name_custom_action, array("sort_options" => $sort_options, "request_uri" => $request_uri, "modelName" => $modelName, "modelInstance" => $model, "models" => $models, "columns" => $columns));
} else {
$view = View::make("lara_admin::models.index", array("sort_options" => $sort_options, "request_uri" => $request_uri, "modelName" => $modelName, "modelInstance" => $model, "models" => $models, "columns" => $columns));
}
$this->defaultAttrForLayout($modelName, $view);
return $this->response_with(array("xml", "json", "csv"), $this->collectionToArray($models->results), true);
}
示例15: update
public function update()
{
$inputs = Input::all();
$reglas = array('nombres' => 'required|min:4', 'apellido' => 'required');
$mensajes = array('required' => 'Campo Obligatorio');
$validar = Validator::make($inputs, $reglas);
if ($validar->fails()) {
Input::flash();
return Redirect::back()->withInput()->withErrors($validar);
} else {
$id = Input::get('id');
$cliente = Cliente::find($id);
$cliente->nombres = Input::get('nombres');
$cliente->apellido = Input::get('apellido');
$cliente->tipo_doc = Input::get('tipo_doc');
$cliente->documento = Input::get('documento');
$cliente->email = Input::get('email');
$cliente->calle = Input::get('calle');
$cliente->num = Input::get('num');
$cliente->piso = Input::get('piso');
$cliente->localidad = Input::get('localidad');
$cliente->telefono = Input::get('telefono');
$cliente->celular = Input::get('celular');
$cliente->save();
return Redirect::to('lista_clientes')->with('error', 'El Cliente ha sido actualizado con Éxito')->withInput();
}
}