noahbass/smart-urls

Laravel 包,用于使用协议相对 URL。

dev-master 2015-01-13 14:43 UTC

This package is not auto-updated.

Last update: 2024-09-28 17:17:48 UTC


README

Build Status Release License

通过生成 协议相对 URL 使 Laravel 更智能。

版本

目前支持 Laravel 4。Laravel 5 即将推出。

安装

Composer require

composer require noahbass/smart-urls

或者将其添加到 composer.json

"require": {
	"noahbass/smart-urls": "dev-master"
}

URL

Noahbass\SmartUrls\SUrl 可用于别名。在 app/config/app.php 中使用它

'URL' => 'Noahbass\SmartUrls\SUrl'

URL 使用

{{ URL::to('something') }}
# will produce: //<host>/something

表单

Noahbass\SmartUrls\SForm 可用于别名。它必须与 Illuminate\Support\Facades\Form 结合使用。在 app/config/app.php 中按需使用

'Form'  => 'Illuminate\Support\Facades\Form',
'SForm' => 'Noahbass\SmartUrls\SForm'

表单使用(仅适用于 openclosemodel 方法)

{{ SForm::open(['url' => 'something']) }}
# will produce: <form method="POST" action="//<host>/something" accept-charset="UTF-8">...

待办事项

  • 为 Laravel 表单等添加相同的协议相对 URL。
  • 测试