nanuc / helpers
此包的最新版本(1.0.13)没有可用的许可证信息。
1.0.13
2023-03-22 12:12 UTC
Requires
- php: ^7.3|^8.0|^8.1|^8.2
- ext-intl: *
- ext-json: *
Requires (Dev)
- orchestra/testbench: ^6.0
README
composer require nanuc/helpers
发布配置:php artisan vendor:publish --provider="Nanuc\Helpers\HelpersServiceProvider" --tag=config
用法
快速日志
仅是 Log::info
的缩写:l('Log something');
DateTime 辅助函数
<x-helpers-date-time format="date.short" :date="$user->updated_at"/>
可用的格式(以德语为例)
'medium' => '%a, %d. %b %Y %H:%M',
'long' => '%A, %d. %B %Y %H:%M',
'short' => '%d.%m.%Y, %H:%M',
'with-seconds' => '%d.%m.%Y, %H:%M:%S',
'date' => [
'short' => '%d.%m.%Y',
'medium' => '%A, %d. %B %Y',
],
'time' => [
'short' => '%H:%M',
'short-appendix' => '%H:%M Uhr',
],
选项卡
使用方法
<x-helpers::tabs active="First">
<x-helpers::tab name="First">
First content goes here.
</x-helpers::tab>
<x-helpers::tab name="Second">
Second content goes here.
</x-helpers::tab>
<x-helpers::tab name="Third">
Third content goes here.
</x-helpers::tab>
</x-helpers::tabs>
传统选项卡
使用方法
<x-helpers-tabs.tabs activeElement="tab1">
<x-slot name="links" >
<x-helpers-tabs.tab-link color-scheme="blue" id="tab1" title="Tab 1" type="underline"/>
<x-helpers-tabs.tab-link color-scheme="blue" id="tab2" title="Tab 2" type="underline"/>
</x-slot>
<x-helpers-tabs.tab-content id="tab1">
Content Tab 1
</x-helpers-tabs.tab-content>
<x-helpers-tabs.tab-content id="tab2">
Content Tab 2
</x-helpers-tabs.tab-content>
</x-helpers-tabs.tabs>
集合宏
enumerate
collect([1, 2, 3])
=> "1, 2 and 3"
toEloquentCollection
将普通集合转换为 Eloquent 集合。
Socialite 登录
要使用此功能,需要安装 Jetstream。
设置凭证(https://laravel.net.cn/docs/8.x/socialite#configuration)
GOOGLE_CLIENT_ID=... GOOGLE_CLIENT_SECRET=... GOOGLE_REDIRECT=https://yoururl.com/auth/google/callback
在配置中启用 Socialite
// config/helpers.php return [ // ... 'socialite' => [ 'enabled' => true, ] ];
安装 Socialite:composer require laravel/socialite
登录按钮
<x-helpers::buttons.social-login provider="google"/>
Helpscout
嵌入信标
在 .env 中包含您的信标密钥:HELPSCOUT_BEACON_KEY=12345678-abcd-efgh-1234-abcdefghijkl