I wanted a calendar in my website, so i use full calendar lib to create these calendar with event. This I just did, now i have a new problem and i cant resolve it. for exemple i want that when it is create an event, it be possible to repeat these event every day or weeks
My code is:
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');
}
}
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;
}
}
My controller:
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'));
}
i dont know how can fix this because i just a start in laravel. I need help to resolve it