本文整理汇总了PHP中back函数的典型用法代码示例。如果您正苦于以下问题:PHP back函数的具体用法?PHP back怎么用?PHP back使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了back函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: destroyByEmail
public function destroyByEmail(SubscriberRemoveRequest $request)
{
$email = $request->only('email');
Subscriber::where(['email' => $email['email']])->delete();
Activity::log('User Unsubscribed');
return back()->withSuccess("Sorry To See You Go! :(");
}
开发者ID:themiloagency,项目名称:testrepo,代码行数:7,代码来源:SubscribersController.php
示例2: delete_news
public function delete_news(Request $request)
{
$id = $request->item_id;
$news = News::find($id);
$news->delete();
return back()->with('message', "Новость удалена");
}
开发者ID:steverovsky,项目名称:cycle-store,代码行数:7,代码来源:NewsController.php
示例3: signInAuth
public function signInAuth(SignInRequest $request)
{
if ((new Authenticate($request->input('username'), $request->input('password')))->check()) {
return redirect()->route('index');
}
return back()->withErrors(['formError' => 'Invalid username or password.']);
}
开发者ID:BePsvPT,项目名称:EcourseLite,代码行数:7,代码来源:AuthController.php
示例4: authenticate
public function authenticate(Request $request)
{
// validate the info, create rules for the inputs
$rules = array('email' => 'required|email', 'password' => 'required|alphaNum|min:3');
// run the validation rules on the inputs from the form
$validator = Validator::make($request->all(), $rules);
// if the validator fails, redirect back to the form
if ($validator->fails()) {
return back()->withErrors($validator->errors())->withInput($request->except('password'));
// send back the input (not the password) so that we can repopulate the form
} else {
// create our user data for the authentication
$userdata = array('email' => $request->email, 'password' => $request->password);
$remember = $request->remember;
// attempt to do the login
if (Auth::attempt($userdata, $remember)) {
// validation successful!
// redirect them to the secure section or whatever
// return Redirect::to('secure');
// for now we'll just echo success (even though echoing in a controller is bad)
$user = Auth::user();
$logged_in_user = User::findOrFail($user->id);
$logged_in_user->logged_in = true;
$logged_in_user->save();
return redirect('dashboard')->with('status', 'Logged in!');
} else {
// validation not successful, send back to form
return back()->with('status', 'Couldnt log you in with the details you provided!')->withInput($request->except('password'));
}
}
}
开发者ID:purplenimbus,项目名称:Nimbus-SMS,代码行数:31,代码来源:AuthController.php
示例5: postLogin
/**
* Handle a login request to the application.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function postLogin(Request $request)
{
$this->validate($request, [$this->loginUsername() => 'required', 'password' => 'required']);
// If the class is using the ThrottlesLogins trait, we can automatically throttle
// the login attempts for this application. We'll key this by the username and
// the IP address of the client making these requests into this application.
$throttles = $this->isUsingThrottlesLoginsTrait();
if ($throttles && $this->hasTooManyLoginAttempts($request)) {
return $this->sendLockoutResponse($request);
}
$credentials = $this->getCredentials($request);
if (Auth::attempt($this->user(), $credentials, $request->has('remember'))) {
return $this->handleUserWasAuthenticated($request, $throttles);
}
// If the login attempt was unsuccessful we will increment the number of attempts
// to login and redirect the user back to the login form. Of course, when this
// user surpasses their maximum number of attempts they will get locked out.
if ($throttles) {
$this->incrementLoginAttempts($request);
}
if ($redirectUrl = $this->loginPath()) {
return redirect($redirectUrl)->withInput($request->only($this->loginUsername(), 'remember'))->withErrors([$this->loginUsername() => $this->getFailedLoginMessage()]);
} else {
return back()->withInput($request->only($this->loginUsername(), 'remember'))->withErrors([$this->loginUsername() => $this->getFailedLoginMessage()]);
}
}
开发者ID:guillermomartinez,项目名称:Laravel-Multiauth,代码行数:32,代码来源:AuthenticatesUsers.php
示例6: responseAddGp
public function responseAddGp(Request $request)
{
$courseId = $request->input('courseId');
$name = $request->input('name');
$result = $this->gpsController->addGp($name, $courseId);
return back();
}
开发者ID:joseph1125,项目名称:cis,代码行数:7,代码来源:GroupsPageController.php
示例7: render
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e)
{
if ($e instanceof FormValidationException) {
return back()->withInput()->withErrors($e->getErrors());
}
return parent::render($request, $e);
}
开发者ID:kriminal666,项目名称:crimibook,代码行数:14,代码来源:Handler.php
示例8: upload
/**
* Handles file uploading and populating table with team data.
* @param Request $request Http request
*/
public function upload(Request $request)
{
//check file size is between 1kB and 2kB
//soccer dat is about 1.4kB
$this->validate($request, ['file' => 'between:1,2']);
//checks if the request has a file named 'file'
if ($request->hasFile('file')) {
$data = array();
//check if file uploaded successfully
if ($request->file('file')->isValid()) {
$file = $request->file('file');
//only read file
$fileObject = $file->openFile('r');
try {
$data = $this->extractData($fileObject);
$this->populateTable($data);
} catch (Exception $e) {
Log::error($e->getMessage());
return back()->withErrors(['Error Saving the data']);
}
return back()->with('success', 'Successful upload.');
} else {
return back()->withErrors(['Unable to upload file.']);
}
return 'cool';
} else {
return back()->withErrors(['No File submitted.']);
}
}
开发者ID:any626,项目名称:soccer-api,代码行数:33,代码来源:FileController.php
示例9: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
// ajax upload
if ($request->ajax()) {
// check upload image
if (!$request->hasFile('uploadImg')) {
// return json data with error message noImgUpload
return response()->json(['error' => 'noUploadImg']);
} else {
if (!$this->checkImage($request->file('uploadImg'))) {
// return json data with error message wrongImgType
return response()->json(['error' => 'wrongImgType']);
} else {
if (filesize($request->file('uploadImg')->getPathname()) > 2 * 2 ** 20) {
return response()->json(['error' => 'file size is bigger than 2MB']);
}
}
}
} else {
// check has uploadImg or not
if ($request->hasFile('uploadImg')) {
// check image content
if (!$this->checkImage($request->file('uploadImg'))) {
// check fail, redirect back with errors
return back()->withInput($request->except('uploadImg'))->withErrors('小搗蛋 大頭貼只能選圖片唷:)');
}
}
}
// pass all check
return $next($request);
}
开发者ID:weiyeu,项目名称:laravel_date,代码行数:38,代码来源:CheckUploadImg.php
示例10: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param $model
*
* @return mixed
*/
public function handle($request, Closure $next, $model)
{
// gather info
$model = '\\AbuseIO\\Models\\' . $model;
$account = Auth::user()->account;
// try to retrieve the id of the model (by getting it out the request segment or out the input)
$model_id = $request->segment(self::IDSEGMENT);
if (empty($model_id)) {
$model_id = $request->input('id');
}
// sanity checks on the model_id
if (!empty($model_id) and preg_match('/\\d+/', $model_id)) {
// only check if the checkAccountAccess exists
if (method_exists($model, 'checkAccountAccess')) {
if (!$model::checkAccountAccess($model_id, $account)) {
// if the checkAccountAccess() fails return to the last page
return back()->with('message', 'Account [' . $account->name . '] is not allowed to access this object');
}
} else {
Log::notice("CheckAccount Middleware is called for {$model}, which doesn't have a checkAccountAccess method");
}
} else {
Log::notice("CheckAccount Middleware is called, with model_id [{$model_id}] for {$model}, which doesn't match the model_id format");
}
return $next($request);
}
开发者ID:ihatehandles,项目名称:AbuseIO,代码行数:35,代码来源:CheckAccount.php
示例11: login
protected function login()
{
if (auth()->attempt(array('email' => Input::get('email'), 'password' => Input::get('password')), true) || auth()->attempt(array('name' => Input::get('email'), 'password' => Input::get('password')), true)) {
return Redirect::intended('/');
}
return back()->withInput()->with('message', 'Неверное имя пользователя и/или пароль!');
}
开发者ID:Anatoly38,项目名称:proj01.laravel,代码行数:7,代码来源:AuthController.php
示例12: post
/**
* @param Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function post(Request $request)
{
$data['title'] = $request->bugTitle;
$data['description'] = $request->bugDescription;
$data['controller'] = $request->controller;
if (!Auth::user()) {
$data['email'] = $request->bugEmail;
$data['name'] = $request->bugName;
$validator = Validator::make($request->all(), ['bugEmail' => 'required|email|max:255', 'bugName' => 'required|max:255|alpha_space', 'bugTitle' => 'required|max:255', 'bugDescription' => 'required|max:255']);
} else {
$data['email'] = Auth::user()->email;
$data['name'] = Auth::user()->name;
$validator = Validator::make($request->all(), ['bugTitle' => 'required|max:255|email', 'bugDescription' => 'required|max:255']);
}
if ($validator->fails()) {
return back()->withErrors($validator)->withInput()->with('modal', true);
}
$response = Mail::send('emails.ladybug', $data, function ($message) use($data) {
$message->from($data['email'], $data['name']);
$message->subject("Bug Report");
$message->to('[email protected]');
});
if ($response) {
return back()->with('success', 'Your report has been sent.');
} else {
return back()->with('error', 'An error occured, please try again.');
}
}
开发者ID:Shoodey,项目名称:Events,代码行数:32,代码来源:BugController.php
示例13: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Requests\RackRequest $request)
{
//
$data = $request->except('_token');
Rack::create($data);
return back();
}
开发者ID:sunhuang2015,项目名称:mytask,代码行数:13,代码来源:RackController.php
示例14: hapus
public function hapus()
{
$id = Input::get('USERS_ID');
$user = User::where('USERS_ID', '=', $id);
$user->delete();
return back();
}
开发者ID:artcakstudio,项目名称:tiketsaya,代码行数:7,代码来源:UsermanagementController.php
示例15: update
public function update(Request $request)
{
$data = $request->all();
$user = User::whereId(Auth::user()->id)->first();
if ($user->email != $data['email']) {
$checkemail = User::where('email', '=', $data['email'])->first();
if (!$checkemail) {
$user->email = $data['email'];
} else {
alert()->warning(' ', 'Cet adresse email est déjà utilisée !')->autoclose(3500);
return back()->withInput();
}
}
$user->firstname = $data['firstname'];
$user->lastname = $data['lastname'];
if ($data['password']) {
if ($data['password'] == $data['password_confirmation']) {
$user->password = bcrypt($data['password']);
} else {
alert()->warning(' ', 'Les mots de passe ne correspondent pas !')->autoclose(3500);
return back()->withInput();
}
}
$user->save();
alert()->success(' ', 'Profil modifié !')->autoclose(3500);
return redirect('/membres/profil/');
}
开发者ID:decalages,项目名称:ct-base,代码行数:27,代码来源:MembreController.php
示例16: postSignin
/**
* Account sign in form processing.
*
* @return Redirect
*/
public function postSignin()
{
// Declare the rules for the form validation
$rules = array('email' => 'required|email', 'password' => 'required|between:3,32');
// Create a new validator instance from our validation rules
$validator = Validator::make(Input::all(), $rules);
// If validation fails, we'll exit the operation now.
if ($validator->fails()) {
// Ooops.. something went wrong
return back()->withInput()->withErrors($validator);
}
try {
// Try to log the user in
if (Sentinel::authenticate(Input::only('email', 'password'), Input::get('remember-me', false))) {
// Redirect to the dashboard page
return Redirect::route("dashboard")->with('success', Lang::get('auth/message.signin.success'));
}
$this->messageBag->add('email', Lang::get('auth/message.account_not_found'));
} catch (NotActivatedException $e) {
$this->messageBag->add('email', Lang::get('auth/message.account_not_activated'));
} catch (ThrottlingException $e) {
$delay = $e->getDelay();
$this->messageBag->add('email', Lang::get('auth/message.account_suspended', compact('delay')));
}
// Ooops.. something went wrong
return back()->withInput()->withErrors($this->messageBag);
}
开发者ID:kevin416,项目名称:admin,代码行数:32,代码来源:AuthController.php
示例17: store
public function store(Request $request, Task $task)
{
$task->addNote(new Note($request->all()));
$task->setUpdatedAt(Carbon::now()->toDateTimeString());
$task->save();
return back();
}
开发者ID:macewanCS,项目名称:librasoft,代码行数:7,代码来源:NotesController.php
示例18: getDetachField
public function getDetachField($field_id, $ct_id)
{
$type = ContentType::find($ct_id);
$field = Field::find($field_id);
$type->fieldable()->detach($field->id);
return back()->withMsg("Поле \"{$field->name}\" от материала \"{$type->name}\" успешно отвязано");
}
开发者ID:scrobot,项目名称:backend-content-types,代码行数:7,代码来源:ContentTypesController.php
示例19: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store($jenis)
{
if ($jenis == 'kategori') {
$rules = array("judul" => "required", "status" => "required");
$data = new Kategori();
$validator = Validator::make(Input::all(), $rules);
if ($validator->passes()) {
$data->judul = strtolower(Input::get('judul'));
$data->aktif = Input::get('status');
$data->save();
return redirect('/bos/kategori');
} else {
return back()->withInput()->with('message', 'Lengkapi data terlebih dahulu');
}
}
if ($jenis == 'artikel') {
$rules = array("judul" => "required");
$valid = Validator::make(Input::all(), $rules);
if ($valid->passes()) {
$data = new Artikel();
$data->judul = ucwords(Input::get('judul'));
$data->slug = strtolower(str_replace(" ", "-", trim(Input::get('judul'))));
$data->kategori = Input::get('kategori');
$data->aktif = Input::get('aktif');
$data->isi = Input::get('isi');
$data->save();
return redirect('/bos/artikel');
} else {
return back()->withInput()->with('message', 'Lengkapi data anda terlebih dahulu');
}
}
}
开发者ID:andreepratama27,项目名称:melayupedia,代码行数:37,代码来源:BlogController.php
示例20: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(HandleUserRequest $request, $userId)
{
$user = $this->user->findOrFail($userId);
$user->update($request->input());
$user->customer()->update($request->input());
return back()->with('success', 'Saved!');
}
开发者ID:RichardMarbach,项目名称:mkdir,代码行数:14,代码来源:UserController.php
注:本文中的back函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论