本文整理汇总了PHP中Illuminate\Support\Facades\Redirect::home方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::home方法的具体用法?PHP Redirect::home怎么用?PHP Redirect::home使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Redirect
的用法示例。
在下文中一共展示了Redirect::home方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return Redirect::home();
}
return $next($request);
}
示例2: store
/**
* @param Requests\SignUpRequest $request
* @param CommandDispatcher $commandDispatcher
*
* @return
*/
public function store(Requests\SignUpRequest $request, CommandDispatcher $commandDispatcher)
{
$commandDispatcher->dispatchFrom(RegisterUser::class, $request);
\Auth::login(User::where('username', $request['username'])->first());
Flash::overlay('Welcome!!');
return Redirect::home();
}
示例3: destroy
public function destroy($id)
{
$user = $this->userRepository->findById($id);
if ($this->userRepository->delete($user)) {
return Redirect::home()->with('success', 'word.deleted');
}
return Redirect::back('/')->with('errors', 'word.error');
}
示例4: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
$headline = Headline::where('uid', $id)->first();
if ($headline) {
return view('headline', ['headline' => $headline]);
}
return Redirect::home();
}
示例5: store
public function store()
{
$this->registrationForm->validate(Input::all());
$user = $this->execute(RegisterUserCommand::class);
Auth::login($user);
Flash::overlay('WELCOME! Glad to have you as a new Larabook member!');
return Redirect::home();
}
示例6: index
/**
* Show the Administrator panel.
*
* @return \Illuminate\View\View
*/
public function index()
{
try {
$user = Auth::user()->with('projects')->where('id', '=', '2')->firstOrFail();
} catch (ModelNotFoundException $e) {
return Redirect::home();
}
// if it's admin, redirect to admin cms with all users but admin
$allUsers = User::whereNotIn('id', [2])->get();
$allSponsors = Sponsor::all();
// Retrieve all projects pending approval.
$pendingProjects = Project::where('approved', '=', '0')->where('application_status', '=', '1')->where('live', '=', '0')->get();
return view('adminpanel.index', compact('user', 'allUsers', 'pendingProjects', 'allSponsors'));
}
示例7: loginPost
/**
* Logs the user in.
*
* @return \Illuminate\Http\RedirectResponse
*/
public function loginPost()
{
$loginData = Request::only(['login', 'password']);
// Login with username or email.
$loginKey = Str::contains($loginData['login'], '@') ? 'email' : 'username';
$loginData[$loginKey] = array_pull($loginData, 'login');
// Validate login credentials.
if (Auth::validate($loginData)) {
// Log the user in for one request.
Auth::once($loginData);
// We probably want to add support for "Remember me" here.
Auth::attempt($loginData);
//return Redirect::intended('/')
return Redirect::home()->withSuccess(trans('gitamin.signin.success'));
}
return Redirect::route('auth.login')->withInput(Request::except('password'))->withError(trans('gitamin.signin.invalid'));
}
示例8: getLogout
/**
*
*/
public function getLogout()
{
Auth::logout();
return Redirect::home();
}
示例9: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store()
{
$user = User::create(Input::only('username', 'email', 'password'));
Auth::login($user);
return Redirect::home();
}
示例10: modelNotFoundError
/**
* generates an error response when the model is not found or redirects home with an error
*
* @param String $message the message to print
* @return Response
*/
protected function modelNotFoundError($message = 'elemento non trovato')
{
$data = array('error' => true, 'message' => $message);
if ($this->isAjaxRequest()) {
return $this->jsonResponse($data, 404);
}
return Redirect::home()->with('error', $message);
}
示例11: validateOwnership
/**
* Validate the ownership of a route.
*
* @param Route $route
* @param string $parameter
* @param string|array $fields
*
* @return \Illuminate\Http\RedirectResponse|null
*/
protected function validateOwnership($route, $parameter, $fields = 'user_id')
{
$fields = (array) $fields;
if (Auth::check()) {
$user = Auth::user();
// Gather fields
$model = $route->getParameter($parameter);
if (!$model) {
return;
}
foreach ($fields as $key => $field) {
$fields[$key] = $model->{$field};
}
// Validate ownership
if ($model and !in_array($user->id, $fields)) {
return Redirect::home();
}
}
}
示例12: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
*
* @return Response
*/
public function destroy($id = null)
{
Auth::logout();
return Redirect::home();
}
示例13: getQueries
/**
* Get all queries by route.
*/
protected function getQueries()
{
$crawler = $this->getCrawler();
// Spoof Redirect::back
$endpoint = Redirect::home();
Redirect::shouldReceive('to')->andReturn($endpoint);
Redirect::shouldReceive('back')->andReturn($endpoint);
// Create Client
$this->laravel['auth']->loginUsingId($this->user);
$client = new Client($this->laravel, []);
// Crawl routes
$routes = $crawler->getRoutes();
$this->info('Found ' . count($routes) . ' routes');
foreach ($routes as $route) {
$this->inspect($client, $route);
}
}
示例14: show
/**
* Display the specified resource.
*
* @param $username
* @internal param int $id
* @return Response
*/
public function show($username)
{
try {
$user = Auth::user()->with('projects')->where('user_name', $username)->firstOrFail();
} catch (ModelNotFoundException $e) {
return Redirect::home();
}
// Take the Administrator to the admin panel.
if ($user->id == '2') {
return redirect('admin');
}
$contributions = Pledge::where('user_id', '=', $user->id)->get();
$favourites = Favourite::with('project')->where('user_id', '=', $user->id)->get();
// if it's a regular user, redirect to user's dashboard
return view('userpanel.index', compact('user', 'contributions', 'favourites'));
}
示例15: destroy
/**
* Log a user out of larabook.
*
* @param int $id
* @return Response
*/
public function destroy()
{
Auth::logout();
Flash::message('You have now been logged out.');
return Redirect::home();
}