xorth/gotourl

保存一个URL,以便稍后重定向用户

0.1.1 2017-04-28 22:17 UTC

This package is auto-updated.

Last update: 2024-09-29 04:42:42 UTC


README

Latest Stable Version Latest Unstable Version License

此composer包为您的laravel 5.3应用程序提供了一个易于使用的重定向器。

安装

首先,通过Composer引入此包。

composer require xorth/gotourl

接下来,在您的config/app.php文件中包含服务提供者。

'providers' => [
    Xorth\GoToUrl\GoToUrlServiceProvider::class,
];

如果您喜欢,可以在config/app.php文件的别名键中注册Go外观。

'aliases' => [
    'Go' => \Go::class,
];

使用方法

在您的控制器中,在执行保存、编辑或删除操作之前,调用go()函数以保存您想要去的地方。

public function create()
{
    go()->after(); // Get the full url through $request->fullUrl()

    // do more stuff
}
public function save()
{
    // do something

    return go()->now();
}

您还可以这样做

  • go('/something/to/show')
  • go()->after('/something/to/show')
  • Go::after('/something/to/show'):仅当外观已注册时。
  • Go::now():仅当外观已注册时。

如果您在应用程序的不同部分保存、更新或删除内容,这将非常有用。