spyrmp/working-days
最新稳定版本:v0.0.1
Composer 安装命令:
composer require spyrmp/working-days
包简介
README 文档
README
Laravel plugin for working days.Get working days from the current week. Use custom validation for Date fields.
Install
This project can be installed via Composer run the following command:
composer require spyrmp/working-days
Add the Service Provider & Facade/Alias
Once spyrmp/working-days is installed, you need to register the service provider in config/app.php. Make sure to add the following line above the RouteServiceProvider.
\Spyrmp\WorkingDays\WorkingDayServiceProvider::class,
You may add the following aliases to your config/app.php:
'WorkingDays' => Spyrmp\WorkingDays\Facades\WorkingDays::class,
Publish the package config file by running the following command:
php artisan vendor:publish --provider="Spyrmp\WorkingDays\WorkingDayServiceProvider" --tag="working-days"
Usage
Get working days of the current week
$carbon = Carbon::make('2022-01-03'); // First day of the week $workingDays = \WorkingDays::getWorkingDays($carbon); dd($workingDays); // Carbon[]|[]
Get non-working days of the current week
$carbon = Carbon::make('2022-01-03'); // First day of the week $nonWorkingDays = \WorkingDays::getNonWorkingDays($carbon); dd($nonWorkingDays); // Carbon[]|[]
###Validation Rules
is_non_working_day
The field under validation must be a value of non-working days. The dates will be passed into the PHP Carbon function in order to be converted into a valid DateTime instance.
is_working_day
The field under validation must be a value of working days. The dates will be passed into the PHP Carbon function in order to be converted into a valid DateTime instance.
$rule= [ "date1"=>"is_non_working_day" "date2"="is_working_day" ]; $inputs = $request->all(); $validation = Validator::make($inputs, $rule);
统计信息
- 总下载量: 45
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-01-01