本文整理汇总了PHP中Redirect::to_action方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::to_action方法的具体用法?PHP Redirect::to_action怎么用?PHP Redirect::to_action使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redirect
的用法示例。
在下文中一共展示了Redirect::to_action方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_show
/**
* get_show takes in a username, finds the user's id from the username, gets the information about the user from the
* followers and critts table and outputs it into the others.profile view
*/
public function action_show($username)
{
// we get the user's id that matches the username
$user_id = User::where('username', '=', $username)->only('id');
// declare some default values for variables
$following = null;
$followers = 0;
// if the username is not found, display an error
if ($user_id == null) {
echo "This username does not exist.";
} else {
if (Auth::user()) {
// if the user tries to go to his/her own profile, redirect to user's profile action.
if ($user_id == Auth::user()->id) {
return Redirect::to_action('user@index');
}
// check if the current user is already following $username
$following = Follower::where('user_id', '=', Auth::user()->id)->where('following_id', '=', $user_id)->get() ? true : false;
}
// eager load the critts with user data
$allcritts = Critt::with('user')->where('user_id', '=', $user_id);
// order the critts and split them in chunks of 10 per page
$critts = $allcritts->order_by('created_at', 'desc')->paginate(10);
// count the critts
$critts_count = $allcritts->count();
// count the followers
$followers = Follower::where('following_id', '=', $user_id)->count();
// bind data to the view
return View::make('others.profile')->with('username', $username)->with('user_id', $user_id)->with('following', $following)->with('followers', $followers)->with('count', $critts_count)->with('critts', $critts);
}
}
示例2: post_site
/**
* Site Setting post
* @return redirect Redirecting to user list
*/
public function post_site()
{
if (!Auth::can('edit_settings')) {
Vsession::cadd('y', __('site.not_allowed'))->cflash('status');
return Redirect::to_action('site@status');
}
if (Input::get('submit')) {
// Registering language validator
Validator::register('language_exists', function ($attribute, $value, $parameters) {
if (array_key_exists($value, Config::get('site.languages'))) {
return true;
}
});
// So these are the rules
$rules = array('language' => 'required|language_exists');
$input = Input::all();
$validation = Validator::make($input, $rules);
if ($validation->fails()) {
Vsession::cadd('r', $validation->errors->first())->cflash('status');
} else {
foreach ($input as $field => $value) {
if (!empty($value)) {
$value = trim(filter_var($value, FILTER_SANITIZE_STRING));
DB::table('settings')->where_field($field)->take(1)->update(array('value' => $value));
}
}
Vsession::cadd('g', __('site.st_settings_up'))->cflash('status');
return Redirect::to_action('setting@site');
}
}
return $this->get_site();
}
示例3: action_add_album
public function action_add_album()
{
$user = $this->is_logged();
if ($user === false) {
return Redirect::to_action('login');
} else {
$album = new Album();
if ($_POST['name'] != "") {
$album->set_name_album($_POST['name']);
} else {
$this->_error_msg = "Il y a une erreur dans le nom de l'album.";
$this->_error_form = true;
}
if (is_numeric($_POST['anneeF']) and preg_match("/^[0-2][0-9]{3}+\$/", $_POST['anneeF']) == 1) {
$album->set_date_prod_album($_POST['anneeF']);
} else {
$this->_error_msg .= "<br>Il y a une erreur dans l\\'année de production (Format : AAAA).";
$this->_error_form = true;
}
if ($this->_error_form == false) {
$album->set_id_user_lif($user->get_id_user_lif());
$album->set_id_band($_POST['band']);
$album->add();
return Redirect::to_action('album');
} else {
return Redirect::to_action('album@add')->with('error', true)->with('form', $_POST)->with('error_msg', $this->_error_msg);
}
}
}
示例4: get_logout
public function get_logout()
{
//GET LOGOUT
Auth::logout();
Session::flush();
return Redirect::to_action('cms::login');
}
示例5: action_add_band
public function action_add_band()
{
$user = $this->is_logged();
if ($user === false) {
return Redirect::to_action('login');
} else {
$band = new Band(null);
if ($_POST['name'] != "") {
$band->set_name_band($_POST['name']);
} else {
$this->_error_msg = "Il y a une erreur dans le nom du groupe. <br> ";
$this->_error_form = true;
}
if (is_numeric($_POST['anneeF']) and preg_match("/^[0-2][0-9]{3}+\$/", $_POST['anneeF']) == 1) {
$band->set_date_form_band($_POST['anneeF']);
} else {
$this->_error_msg .= "Il y a une erreur dans la date de formation (Format : AAAA).<br> ";
$this->_error_form = true;
}
if (is_numeric($_POST['anneeD']) or $_POST['anneeD'] == "") {
$band->set_date_disband_band($_POST['anneeD']);
}
if ($this->_error_form == false) {
$band->set_id_user_lif($user->get_id_user_lif());
$band->add();
return Redirect::to_action('band');
} else {
return Redirect::to_action('band@add')->with('error', true)->with('form', $_POST)->with('error_msg', $this->_error_msg);
}
}
}
示例6: action_updateusers
public function action_updateusers($user_id)
{
$user = User::find($user_id);
$user->accessible(array('username', 'email', 'verified', 'disabled', 'deleted'));
$user->fill(Input::all())->save();
return Redirect::to_action('panel::site@editusers', array($user_id))->with('success', '1');
}
示例7: action_remove
public function action_remove($id)
{
$post = \Blog\Models\Post::find($id);
if ($post) {
$post->delete();
}
return Redirect::to_action('blog::admin.post@list');
}
示例8: action_resolve
public function action_resolve($post_id)
{
if ($post = Post::where_id($post_id)->first(array('id', 'slug'))) {
return Redirect::to_action('blog::home@show', array($post->id, $post->slug));
} else {
return Event::first('404');
}
}
示例9: post_edit
public function post_edit()
{
$product = Product::find(Input::get('id'));
$product->name = Input::get('name');
$product->short_description = Input::get('short_description');
$product->slug = Str::slug(Input::get('name'), '_');
$product->save();
return Redirect::to_action('admin.products@view', array($product->id))->with('flash', true)->with('flash_type', 'success')->with('flash_msg', 'Product updated successfully.');
}
示例10: action_index
public function action_index()
{
$user = $this->is_logged();
if ($user === false) {
return Redirect::to_action('login');
} else {
return View::make('info.index');
}
}
示例11: post_login
public function post_login()
{
$credentials = array('username' => Input::get('username'), 'password' => Input::get('password'), 'remember' => Input::get('remember'));
if (Auth::attempt($credentials)) {
return Redirect::to_action('admin.dashboard@index')->with('flash', true)->with('flash_type', 'success')->with('flash_msg', 'Logged in successfully.');
} else {
return Redirect::back()->with_input()->with('flash', true)->with('flash_type', 'error')->with('flash_msg', 'Incorrect username or password.');
}
}
示例12: action_add_song_to_playlist
function action_add_song_to_playlist()
{
$user = $this->is_logged();
if ($user === false) {
return Redirect::to_action('login');
} else {
$new_song = new SongPlaylist($_POST['id_song'], $_POST['id_playlist'], $user->get_id_user_lif(), null);
$new_song->add();
}
}
示例13: post_login
public function post_login()
{
//POST LOGIN
$credentials = array('cms' => false, 'username' => Input::get('username'), 'password' => Input::get('password'), 'remember' => (bool) Input::get('remember'));
//CHECK CREDENTIALS
if (Auth::attempt($credentials)) {
//SUCCESS LOGIN
return Redirect::home();
} else {
//ERROR LOGIN
return Redirect::to_action('user@login')->with_input('only', array('username'));
}
}
示例14: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$institution = Institution::findOrFail($id);
//get form data
$data = Input::only('title', 'body', 'topcolor', 'topfontcolor', 'currentdi', 'extracomments');
$data['logo'] = json_encode(Input::get('fileid'));
// validation rules
$rules = array('title' => 'required', 'logo' => 'required');
$validator = Validator::make($data, $rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$institution->update($data);
return Redirect::to_action('InstitutionsController@show', array($id));
}
示例15: get_delete
/**
* Delete transaction
*
* @param int $id Transaction ID
* @return Response
*/
public function get_delete($tid = null)
{
if (!Auth::can('delete_transactions')) {
Vsession::cadd('y', __('site.not_allowed'))->cflash('status');
return Redirect::to_action('transaction@list');
}
if (!is_null($this->filter_transaction($tid))) {
$iid = $this->item_by_transaction($tid);
DB::table('transactions')->delete($tid);
$this->recalculate($iid);
} else {
return Redirect::to_action('transaction@list');
}
Vsession::cadd('g', __('site.st_trans_deleted'))->cflash('status');
return Redirect::to_action('transaction@list');
}