我想在我的网站上使用日历,所以我使用完整的日历库来创建这些日历与事件。这我刚刚做了,现在我有一个新问题,我无法解决它。例如,我希望当它创建一个事件时,可以每天或每周重复这些事件
我的代码是:
class CreateEventModelTable extends Migration
{
public function up()
{
Schema::create('event_model', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->boolean('all_day');
$table->datetime('start');
$table->datetime('end');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('event_model');
}
}
型号:
class EventModel extends Model implements \MaddHatter\LaravelFullcalendar\Event
{
//
protected $dates = ['start', 'end'];
protected $table = 'event_model';
public function getId() {
return $this->id;
}
/**
* Get the event's title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Is it an all day event?
*
* @return bool
*/
public function isAllDay()
{
return (bool)$this->all_day;
}
/**
* Get the start time
*
* @return DateTime
*/
public function getStart()
{
return $this->start;
}
/**
* Get the end time
*
* @return DateTime
*/
public function getEnd()
{
return $this->end;
}
public function getRow(){
return $this->row;
}
}
我的控制器:
public function create() {
$events = [];
$events[] = \Calendar::event(
'Teste',
false,
'2017-07-10',
'2017-07-10',
'[ 1, 4 ]'
);
$events[] = \Calendar::event(
'Teste2', //event title
true, //full day event?
new DateTime('2017-07-14'), //start time (you can also use Carbon instead of DateTime)
new DateTime('2015-07-14') //end time (you can also use Carbon instead of DateTime)
);
$eloquentEvent = EventModel::first();
$calendar = \Calendar::addEvents($events)
->addEvent($eloquentEvent, ['color' => '#800',
])->setOptions([
'firstDay' => 1
])->setCallbacks(['viewRender' => 'function() {alert("Callbacks");}'
]);
return view('CFAE.calendar', compact('calendar'));
}
我不知道如何解决这个问题,因为我只是在laravel开始。我需要帮助来解决它
答案 0 :(得分:0)
$("table").click(function(event) {
event.stopImmediatePropagation();
//Do Stuff
});
循环的绝佳机会。由于我们一年有for()
周的时间,我们可以使用碳来为初始日期增加一周。
52