本文整理汇总了PHP中Redirect::route方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::route方法的具体用法?PHP Redirect::route怎么用?PHP Redirect::route使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redirect
的用法示例。
在下文中一共展示了Redirect::route方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$taxi = Taxi::findOrFail($id);
$taxi->fill($request->all());
$taxi->save();
return \Redirect::route('taxis.index');
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$input = Input::all();
if ($this->post->fill($input)->validate_post()) {
$image = Input::file('attachment');
if ($image->isValid()) {
$path = 'uploads/posts/' . Auth::user()->username;
$filename = 'posts-' . time() . rand(1000, 9999) . '.' . $image->getClientOriginalExtension();
if ($image->move($path, $filename)) {
$data = $this->post->create(['user_id' => Auth::user()->id, 'title' => $input['title'], 'content' => $input['content'], 'attachment' => $filename]);
if ($data->id) {
$post = $this->post->find($data->id);
$post->tags()->attach($input['tags']);
Session::flash('type', 'success');
Session::flash('message', 'Post Created');
return Redirect::route('post.index');
} else {
Session::flash('type', 'error');
Session::flash('message', 'Error!!! Cannot create post');
return Redirect::back()->withInput();
}
} else {
Session::flash('type', 'error');
Session::flash('message', 'Error!!! File cannot be uploaded');
return Redirect::back()->withInput();
}
} else {
Session::flash('type', 'error');
Session::flash('message', 'Error!!! File is not valid');
return Redirect::back()->withInput();
}
} else {
return Redirect::back()->withInput()->withErrors($this->post->errors);
}
}
示例3: update
public function update($id)
{
$validator = Validator::make(array('slider' => Input::file('slider')), array("slider" => "image | mimes:jpeg, jpg, png, gif | max: 6000"), array('mimes' => '<span class="glyphicon glyphicon-remove"></span> Unknown file inserted', 'size' => '<span class="glyphicon glyphicon-exclamation-sign"></span> Size must be less than 6 MB'));
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
} else {
if (Input::file('slider') != '') {
$file = Input::file('slider');
$name = date('i-G-Y') . $file->getClientOriginalName();
$destination = 'assets/images/slider/';
$file->move($destination, $name);
$query = Slider::find($id);
$query->slider = 'assets/images/slider/' . $name;
$query->slider_text = Input::get('text');
if ($query->save()) {
return Redirect::route('slider-page')->with('event', '<p class="alert alert-success"><span class="glyphicon glyphicon-ok"></span> Slider updated successfully</p>');
} else {
return Redirect::back()->with('event', '<p class="alert alert-danger"><span class="glyphicon glyphicon-remove"></span> Error occured. Please try after sometime</p>');
}
} else {
$query = Slider::find($id);
$query->slider_text = Input::get('text');
if ($query->save()) {
return Redirect::route('slider-page')->with('event', '<p class="alert alert-success"><span class="glyphicon glyphicon-ok"></span> Slider updated successfully</p>');
} else {
return Redirect::back()->with('event', '<p class="alert alert-danger"><span class="glyphicon glyphicon-remove"></span> Error occured. Please try after sometime</p>');
}
}
}
}
示例4: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$fob = KeyFob::findOrFail($id);
$fob->markLost();
\Notification::success("Key Fob marked as lost/broken");
return \Redirect::route('account.show', $fob->user_id);
}
示例5: addComment
public function addComment($groupId)
{
$input = \Input::all();
$input['group_id'] = $groupId;
CustomerGroupComment::create($input);
return \Redirect::route('customer-groups.members', $groupId);
}
示例6: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(CreateEstudianteReqest $request)
{
$Est = new Estudiante($request->all());
$Est->estado = 'A';
$Est->save();
return \Redirect::route('estudiantes.index');
}
示例7: destroyList
/**
* Removes all local galleries for the current user list.
*
* @return Response
*/
public function destroyList()
{
$users = Input::get('users');
$userIds = array_pluck($users, 'id');
$removed = $this->gallery->destroyByUsers($userIds);
return Redirect::route('users.index')->with('message', "Has been removed {$removed} galleries");
}
示例8: register
/**
* 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');
}
示例9: getDeactivateApiKey
public function getDeactivateApiKey($key)
{
$apiKey = \App\Models\ApiKey::find($key);
$apiKey->active = 0;
$apiKey->save();
return \Redirect::route('settings.apiKeys.list');
}
示例10: store
public function store()
{
if ($_POST) {
$input = Input::all();
$rules = array('username' => 'required|unique:users', 'password' => 'required', 'email' => 'required|unique:users|email', 'firstname' => 'required|Alpha', 'lastname' => 'required|alpha_dash', 'city' => 'required', 'country' => 'required|Alpha', 'recaptcha_response_field' => 'required|recaptcha');
$validator = Validator::make($input, $rules);
if ($validator->fails()) {
return Redirect::to('register')->withInput()->withErrors($validator);
} else {
$user = new User();
$user->username = Input::get('username');
$user->password = Hash::make(Input::get('password'));
$user->firstname = Input::get('firstname');
$user->lastname = Input::get('lastname');
$user->email = Input::get('email');
$user->city = Input::get('city');
$user->country = Input::get('country');
$user->organisation = Input::get('organisation');
$user->description = Input::get('description');
$user->picture = '';
$user->suspended = 0;
if (Input::hasFile('picture')) {
$file = Input::file('picture');
$pixpath = '/uploads/pix/user/';
$destinationPath = public_path() . $pixpath;
$filename = $user->username . '.' . $file->getClientOriginalExtension();
$file->move($destinationPath, $filename);
$user->picture = base64_encode($pixpath . $filename);
}
$user->save();
return Redirect::to('login')->with('successmessage', trans('master.registersuccess'));
}
}
return Redirect::route('register.index')->withInput()->withErrors($s->errors());
}
示例11: removeNews
public function removeNews($id)
{
$news = News::find($id);
$name = $news->title;
$news->delete();
return Redirect::route('account')->with('status', 'alert-success')->with('global', 'You just deleted ' . $name);
}
示例12: create
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create($username)
{
if (credentialsMatch($username)) {
return View::make('posts.create', ['categories' => $this->categories]);
}
return Redirect::route('login');
}
示例13: login
/**
*
* @return nothing
* @author Tremor
*/
public function login()
{
if (Request::isMethod('post')) {
$post = Input::all();
$rules = ['email' => 'required|email', 'password' => 'required'];
$validator = Validator::make($post, $rules);
if ($validator->fails()) {
$this->setMessage($validator->messages()->all(), 'error');
return Redirect::route('login')->withInput();
} else {
$email = trim(Input::get('email'));
$password = trim(Input::get('password'));
$remember = Input::get('remember') == 1 ? true : false;
if (Auth::attempt(array('email' => $email, 'password' => $password, 'is_admin' => 1))) {
return Redirect::route('admin');
} elseif (Auth::attempt(array('email' => $email, 'password' => $password))) {
return Redirect::route('home');
} else {
$this->setMessage('failed login', 'error');
return Redirect::route('login')->withInput();
}
}
}
return View::make('auth.signin')->with($this->data);
}
示例14: idpAuthorize
/**
* Setup authorization based on returned server variables
* from the IdP.
*/
public function idpAuthorize()
{
$email = $this->getServerVariable(config('shibboleth.idp_login_email'));
$first_name = $this->getServerVariable(config('shibboleth.idp_login_first'));
$last_name = $this->getServerVariable(config('shibboleth.idp_login_last'));
$password = str_random(100);
if ($email) {
$credentials = ['email' => $email];
$user = Sentinel::findByCredentials($credentials);
if ($user) {
Sentinel::login($user);
} else {
// unable to find user, so now we check to see if new users are allowed to be added
if (config('shibboleth.add_new_users', true)) {
// Add New user
$params = ['email' => $email, 'password' => $password, 'first_name' => $first_name, 'last_name' => $last_name];
$user = Sentinel::registerAndActivate($params);
// User starts as role: standard user
$account_type = 1;
// Find the role using the role name
$role = Sentinel::findRoleById($account_type);
// Assign the role to the users
$role->users()->attach($user);
Session::put('auth_type', 'idp');
return \Redirect::route('manage.posts.index')->with('success', 'User (and password) has been created successfully!');
}
return \Redirect::route('home')->with('warning', 'We are not accepting new users at this time');
}
Session::put('auth_type', 'idp');
return $this->viewOrRedirect(config('shibboleth.shibboleth_authenticated'));
} else {
return $this->viewOrRedirect(config('shibboleth.login_fail'));
}
}
示例15: store
/**
* Store a newly created client in storage.
*
* @return Response
*/
public function store($bookingId)
{
$user = Auth::user();
$validator = Validator::make($data = Input::all(), Client::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$data['booking_id'] = $bookingId;
if ($bookingdata = Client::create($data)) {
$booking = Booking::getBookingData($bookingdata->booking_id);
$pdf = PDF::loadView('emails/booking', array('booking' => $booking));
$pdf->save(public_path() . '/temp-files/booking' . $booking->id . '.pdf');
$emails = array('tharinda@exotic-intl.com', 'lahiru@exotic-intl.com', 'umesh@exotic-intl.com');
$ehi_users = User::getEhiUsers();
Mail::send('emails/booking-mail', array('booking' => Booking::getBookingData($booking->id)), function ($message) use($booking, $emails, $ehi_users) {
$message->attach(public_path() . '/temp-files/booking' . $booking->id . '.pdf')->subject('Amended Booking(Client Added): ' . $booking->reference_number)->from('noreply@srilankahotels.com', 'SriLankaHotels.Travel')->bcc('admin@srilankahotels.travel', 'Admin');
foreach ($emails as $emailaddress) {
$message->to($emailaddress, 'Admin');
}
if (!empty($ehi_users)) {
foreach ($ehi_users as $ehi_user) {
$message->to($ehi_user->email, $ehi_user->first_name);
}
}
});
}
return Redirect::route('bookings.show', $bookingId);
}