xtodx / calendar
此包最新版本(0.2.14)没有可用的许可信息。
Laravel 6 弹性日历
0.2.14
2020-02-13 22:55 UTC
Requires
- php: >=7.2.0
- illuminate/support: ~6
README
Laravel 5 弹性日历,支持按月、周和日查看,并可显示每一天的多个事件。
要动态更改视图类型,请传入名为 'cv'(日历视图)的GET变量,其值可以是 'week' 或 'day'。日和周视图分为30分钟间隔的行。
对于 Laravel 4,请使用makzumi/laravel-calendar
Laravel 5 的安装说明
将以下内容添加到 composer.json 中的 "require" 部分
"skecskes/calendar": "0.2.*"
之后运行 composer update
,然后在 /config/app.php 中将以下行添加到 providers 数组中
'providers' => array(
...,
Skecskes\Calendar\CalendarServiceProvider::class,
),
如果您想更改日历的一些默认值,首先使用以下命令发布配置
php artisan vendor:publish
这将创建一个新的配置文件在您的应用中 config/calendar.php
,您可以在其中覆盖默认值。
使用方法
要使用,创建一个新的 Calender 实例并生成它,以下是一些自定义选项
$events = array(
"2014-04-09 10:30:00" => array(
"Event 1",
"Event 2 <strong> with html</stong>",
),
"2014-04-12 14:12:23" => array(
"Event 3",
),
"2014-05-14 08:00:00" => array(
"Event 4",
),
);
$cal = Skecskes\Calendar\Facades\Calendar::make(); // create instance
/**** OPTIONAL METHODS ****/
$cal->setDate(Input::get('cdate')); //Set starting date
$cal->setBasePath('/dashboard'); // Base path for navigation URLs
$cal->showNav(true); // Show or hide navigation
$cal->setView(Input::get('cv')); //'day' or 'week' or null
$cal->setStartEndHours(8,20); // Set the hour range for day and week view
$cal->setTimeClass('ctime'); //Class Name for times column on day and week views
$cal->setEventsWrap(array('<p>', '</p>')); // Set the event's content wrapper
$cal->setDayWrap(array('<div>','</div>')); //Set the day's number wrapper
$cal->setNextIcon('>>'); //Can also be html: <i class='fa fa-chevron-right'></i>
$cal->setPrevIcon('<<'); // Same as above
$cal->setDayLabels(array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat')); //Label names for week days
$cal->setMonthLabels(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')); //Month names
$cal->setDateWrap(array('<div>','</div>')); //Set cell inner content wrapper
$cal->setTableClass('table'); //Set the table's class name
$cal->setHeadClass('table-header'); //Set top header's class name
$cal->setNextClass('btn'); // Set next btn class name
$cal->setPrevClass('btn'); // Set Prev btn class name
$cal->setEvents($events); // Receives the events array
/**** END OPTIONAL METHODS ****/
echo $cal->generate() // Return the calendar's html;