本文整理汇总了PHP中Redirect::to_route方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::to_route方法的具体用法?PHP Redirect::to_route怎么用?PHP Redirect::to_route使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redirect
的用法示例。
在下文中一共展示了Redirect::to_route方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_create_document
public function post_create_document()
{
$document_id = Input::get('document_id');
$user_id = Auth::user()->id;
// we want to get all the input data
//
// take apart the name and value pairs
//
$inputs = Input::all();
//dd($inputs);
foreach (Input::all() as $name => $value) {
if ($name != '0' || $name != 'csrf_token') {
// for some reason, laravel id=gnores form fields with nums as
// the name value so this will fix it
// along with the <input name="id45"..
$name = str_replace('id', '', $name);
Answer::create(array('document_id' => $document_id, 'user_id' => $user_id, 'field_id' => $name, 'answer' => $value));
}
// dd(array(
// 'document_id' => $document_id,
// 'user_id' => $user_id,
// 'field_id' => $key,
// 'answer' => $value
// ));
}
return Redirect::to_route('tenant_view_document', $document_id);
}
示例2: get_erase
public function get_erase($id)
{
$success = "User deleted with success!";
$user = User::find($id);
$user->delete();
return Redirect::to_route('dojo::index_user')->with('success', $success);
}
示例3: home
public function home()
{
// belum login
if (Auth::guest()) {
return Redirect::to_route('login');
}
// sudah login
return Request::ajax() ? View::make('pages.home') : View::make('layout');
}
示例4: post_multi_page_example_two
public function post_multi_page_example_two()
{
$fields = array('street_address', 'suite_number', 'favorite_foods');
if (!ExampleForm::is_valid($fields)) {
return Redirect::back()->with_input()->with_errors(ExampleForm::$validation);
}
ExampleForm::save_input($fields);
return Redirect::to_route('form_examples', array('multi_page_example_review'));
}
示例5: delete_destroy
public function delete_destroy()
{
$cid = Input::get('cid');
$pid = Input::get('pid');
$post = Post::find($pid);
//$post_id = Comment::find(Input::get('id'))->post->slug;
Comment::find($cid)->delete();
return Redirect::to_route('post_view', $post->slug)->with('message', 'Comment has been deleted Successfully!');
}
示例6: get_logout
/**
* Logout dan redirect ke login form
*/
public function get_logout()
{
// Trigger:
// Sebelum logout, mengkosongkan kembali isi folder 'pdf' dan 'files' dari file-file
// lembar disposisi yang digenerate dan CSV yang diimport.
Printpdf::empty_pdf_folder();
Suratkeluar::empty_csv_folder();
Auth::logout();
return Redirect::to_route('login')->with('title', 'Agenda Surat :: Login');
}
示例7: testRedirectsCanBeGeneratedForNamedRoutes
/**
* Test the Redirect::to_route method.
*
* @group laravel
*/
public function testRedirectsCanBeGeneratedForNamedRoutes()
{
Route::get('redirect', array('as' => 'redirect'));
Route::get('redirect/(:any)/(:any)', array('as' => 'redirect-2'));
Route::get('secure/redirect', array('https' => true, 'as' => 'redirect-3'));
$this->assertEquals(301, Redirect::to_route('redirect', array(), 301, true)->status());
$this->assertEquals('http://localhost/redirect', Redirect::to_route('redirect')->headers()->get('location'));
$this->assertEquals('https://localhost/secure/redirect', Redirect::to_route('redirect-3', array(), 302)->headers()->get('location'));
$this->assertEquals('http://localhost/redirect/1/2', Redirect::to_route('redirect-2', array('1', '2'))->headers()->get('location'));
}
示例8: action_do_create
public function action_do_create()
{
$v = Customer::validate(Input::all());
if ($v->fails()) {
return Redirect::to_route('create_customer')->with('user', Auth::user())->with_errors($v)->with_input();
}
$new_customer = array('name' => Input::get('name'), 'description' => Input::get('description'), 'organization_id' => Auth::user()->organization->id);
$customer = new Customer($new_customer);
$customer->save();
return Redirect::to_route('customers');
}
示例9: get_logout
public function get_logout()
{
if (Auth::check()) {
Auth::logout();
Session::flush();
//delete the session
return Redirect::to_route('home')->with('message', 'Logged out');
} else {
return Redirect::to_route('home');
}
}
示例10: delete_destroy
public function delete_destroy()
{
$id = Input::get('id');
//*Note: Make sure to set post_id as your foreign key.
//*Note: Set ON DELETE CASCADE in your comments table
Post::find($id)->delete();
//*Info: Incase you didn't set your comments table "ON DELETE CASCADE", just the code below.
//Post::find($id)->comments()->delete();
//Post::find($id)->delete();
return Redirect::to_route('posts')->with('message', 'Post has been deleted successfully!');
}
示例11: put_update
public function put_update()
{
$id = Input::get('id');
// validasi input apakah sesuai rules (cek di model "suratmasuk")
$validation = Suratmasuk::validate_alt(Input::all());
if ($validation->fails()) {
return Redirect::to_route('edit_suratmasuk', $id)->with_errors($validation);
} else {
$update_surat = Suratmasuk::update_surat($id);
return Redirect::to_route('suratmasuk', $id)->with('message', $update_surat);
}
}
示例12: post_create
public function post_create()
{
$user = new User();
$user->email = Input::get('email');
$user->password = Input::get('password');
if ($user->save()) {
Auth::login($user->id);
return Redirect::to_route('user_account');
} else {
return Redirect::to_route('home')->with('signup_errors', $user->errors->all())->with_input('only', array('email'));
}
}
示例13: action_create
public function action_create()
{
$project = Project::find(Input::get('project_id'));
if (!$project || !$project->question_period_is_open()) {
return Redirect::to_route('project', $project->id);
}
$question = new Question(array('project_id' => Input::get('project_id'), 'question' => Input::get('question')));
$question->vendor_id = Auth::user()->vendor->id;
if ($question->validator()->passes()) {
$question->save();
return Response::json(array("status" => "success", "question" => $question->to_array(), "html" => View::make('projects.partials.question')->with('question', $question)->render()));
} else {
return Response::json(array("status" => "error", "errors" => $question->validator()->errors->all()));
}
}
示例14: action_do_create
public function action_do_create()
{
$project = Project::find(Input::get('project_id'));
$new = array('title' => Input::get('title'), 'description' => Input::get('description'), 'customer_id' => $project->customer_id, 'project_id' => $project->id, 'organization_id' => Auth::user()->organization->id);
$v = Todo::validate($new);
if ($v->fails()) {
// redirect back to the form with
// errors, input and our currently
// logged in user
return Redirect::to_route('create_todo', $project->id)->with_errors($v)->with_input();
}
// create the new post
$o = new Todo($new);
$o->save();
// redirect to viewing our new post
return Redirect::to_route('read_customer', $project->customer_id);
}
示例15: get_add
function get_add($id = null)
{
if ($this->in('clear', false)) {
$this->input = array();
return $this->get_clear();
}
$single = $this->addGetSingle($id);
if ($single === true) {
$this->status('add_many');
} elseif ($single !== null) {
$this->status(Cart::has($single) ? 'add_one' : 'remove', $single->to_array());
}
if ($this->in('checkout', null)) {
return Redirect::to_route('vanemart::checkout');
} else {
return $this->back();
}
}