本文整理汇总了PHP中route函数的典型用法代码示例。如果您正苦于以下问题:PHP route函数的具体用法?PHP route怎么用?PHP route使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了route函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authenticate
/**
* Processes logging in a user.
*
* @param LoginRequest $request
*
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
*/
public function authenticate(LoginRequest $request)
{
try {
$input = $request->all();
$remember = (bool) array_pull($input, 'remember', false);
if ($auth = Sentinel::authenticate($input, $remember)) {
$message = 'Successfully logged in.';
return redirect()->intended(route('maintenance.dashboard.index'))->withSuccess($message);
} else {
if (Corp::auth($input['login'], $input['password'])) {
$user = Corp::user($input['login']);
$name = explode(',', $user->name);
$credentials = ['email' => $user->email, 'username' => $user->username, 'password' => $input['password'], 'first_name' => array_key_exists(1, $name) ? $name[1] : null, 'last_name' => array_key_exists(0, $name) ? $name[0] : null];
return $this->registerAndAuthenticateUser($credentials);
}
}
$errors = 'Invalid login or password.';
} catch (NotActivatedException $e) {
$errors = 'Account is not activated!';
} catch (ThrottlingException $e) {
$delay = $e->getDelay();
$errors = "Your account is blocked for {$delay} second(s).";
}
return redirect()->back()->withErrors($errors);
}
示例2: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
Breadcrumbs::register('portfolio', function ($breadcrumbs) {
$breadcrumbs->push('Портфолио', route('portfolio'));
});
return view('portfolio.index');
}
示例3: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
if (false === env('APP_INSTALLED', false)) {
return redirect(route('installer.index'));
}
return $next($request);
}
示例4: store
public function store(Request $request)
{
if (Auth::attempt($request->only('email', 'password'))) {
return redirect()->intended(route('admin_path'));
}
return redirect()->back()->with('errors', 'Wrong email or password');
}
示例5: 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 new RedirectResponse(route('after_login'));
}
return $next($request);
}
示例6: create
/**
* create form of a varian
*
* 1. Get Previous data and page setting
* 2. Initialize data
* 3. Generate breadcrumb
* 4. Generate view
* @param q
* @return Object View
*/
public function create($pid = null, $id = null)
{
//1. Get Previous data and page setting
$APIProduct = new APIProduct();
$tmpData = $APIProduct->getShow($pid);
//2. Initialize data
$data['pid'] = $tmpData['data']['id'];
$data['name'] = $tmpData['data']['name'];
$data['upc'] = $tmpData['data']['upc'];
$data['data'] = null;
//is edit
if (!is_null($id)) {
$data['data'] = $this->VarianFindData($tmpData['data']['varians'], $id)['data'];
}
//3. Generate breadcrumb
if (is_null($id)) {
$breadcrumb = [$data['name'] => route('goods.product.show', ['id' => $data['pid']]), 'Ukuran Baru' => route('goods.varian.create', ['pid' => $pid])];
} else {
$breadcrumb = [$data['name'] => route('goods.product.show', ['id' => $data['pid']]), 'Edit Ukuran ' . $data['data']['size'] => route('goods.varian.edit', ['pid' => $pid, 'id' => $id])];
}
$this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, $breadcrumb);
//4. Generate view
$this->page_attributes->subtitle = $data['name'];
$this->page_attributes->data = array_merge($data, ['pid' => $pid]);
$this->page_attributes->source = $this->page_attributes->source . 'create';
return $this->generateView();
}
示例7: update
public function update(User $user, UserRequest $request)
{
$user->update($request->all());
$user->roles()->sync($request->input('roleList'));
Flash::success(trans('general.updated_msg'));
return redirect(route('admin.users'));
}
示例8: actionLink
public static function actionLink($item)
{
$baseRoute = static::link(Str::lower($item->status));
$param = ['slug' => $item->info->slug];
$url = route($baseRoute, $param);
return Gate::allows('mod-qdn', $item->info->slug) ? "<a href='{$url}'>{$item->info->control_id}</a>" : "(is active at the moment)";
}
示例9: autoDetectUrl
private function autoDetectUrl($url)
{
if (strpos($url, '/') != 1 && strpos($url, '://') < 0) {
$url = route($url);
}
return $url;
}
示例10: 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(route('backend.dashboard'));
}
return $next($request);
}
示例11: index
/**
* Muestra la pantalla de bievenida a la red
*
* @return Response
*/
public function index()
{
/*
* base_grant_url=https%3A%2F%2Fn126.network-auth.com%2Fsplash%2Fgrant&
* user_continue_url=http%3A%2F%2Fenera.mx&
* node_id=15269408&
* node_mac=00:18:0a:e8:fe:20&
* gateway_id=15269408&
* client_ip=10.77.147.207&
* client_mac=24:a0:74:ed:e6:16
*/
// valida que los paramatros esten presentes
$validate = Validator::make(Input::all(), ['node_mac' => 'required']);
if ($validate->passes()) {
$branche = Branche::whereIn('aps', [Input::get('node_mac')])->first();
// Si el AP fue dado de alta y asignado a una Branche
if ($branche) {
session(['main_bg' => $branche->portal['background']]);
$url = route('welcome::response', ['node_mac' => Input::get('node_mac')]);
// Paso 1: Welcome log
DB::collection('campaign_logs')->where('user.session', session('_token'))->where('device.mac', Input::get('client_mac'))->where('interaction.welcome', 'exists', false)->update(['user' => ['session' => session('_token')], 'device' => ['mac' => Input::get('client_mac')], 'interaction' => ['welcome' => new MongoDate()], 'created_at' => new MongoDate()], array('upsert' => true));
return view('welcome.index', ['image' => $branche->portal['image'], 'message' => $branche->portal['message'], 'login_response' => $this->fbUtils->makeLoginUrl($url)]);
}
}
return view('welcome.invalid', ['main_bg' => 'bg_welcome.jpg']);
}
示例12: trySampleForms
/**
* GET | Redirect the user if the 'users' table is empty or not
* then redirect it to either login or registration.
*
* @return mixed
*/
public function trySampleForms()
{
if (User::count()) {
return redirect()->to(route('showLoginForm'))->withInfo(lang()->get('responses/login.pre_flash_message'));
}
return redirect()->to(route('showRegistrationForm'))->withInfo(lang()->get('responses/register.pre_flash_message'));
}
示例13: getDeleteButtonAttribute
/**
* @return string
*/
public function getDeleteButtonAttribute()
{
if (access()->allow('delete-maps')) {
return '<a href="' . route('admin.maps.delete', $this->id) . '" class="btn btn-xs btn-danger" data-method="delete"><i class="fa fa-times" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.general.crud.delete') . '"></i></a>';
}
return '';
}
示例14: handle
/**
* Handle the event.
*
* @param \CachetHQ\Cachet\Events\UserWasInvitedEvent $event
*
* @return void
*/
public function handle(UserWasInvitedEvent $event)
{
$mail = ['email' => $event->invite->email, 'subject' => 'You have been invited.', 'link' => route('signup.invite', ['code' => $event->invite->code]), 'app_url' => env('APP_URL')];
$this->mailer->queue(['html' => 'emails.users.invite-html', 'text' => 'emails.users.invite-text'], $mail, function (Message $message) use($mail) {
$message->to($mail['email'])->subject($mail['subject']);
});
}
示例15: postIndex
/**
* @return \Illuminate\Http\RedirectResponse
*/
public function postIndex()
{
// front page accounts
$frontPageAccounts = [];
if (is_array(Input::get('frontPageAccounts'))) {
foreach (Input::get('frontPageAccounts') as $id) {
$frontPageAccounts[] = intval($id);
}
Preferences::set('frontPageAccounts', $frontPageAccounts);
}
// view range:
Preferences::set('viewRange', Input::get('viewRange'));
// forget session values:
Session::forget('start');
Session::forget('end');
Session::forget('range');
// budget maximum:
$budgetMaximum = intval(Input::get('budgetMaximum'));
Preferences::set('budgetMaximum', $budgetMaximum);
// language:
$lang = Input::get('language');
if (in_array($lang, array_keys(Config::get('firefly.languages')))) {
Preferences::set('language', $lang);
}
Session::flash('success', 'Preferences saved!');
Preferences::mark();
return redirect(route('preferences'));
}