我在calender中显示我的事件。它将正确显示。但是我希望当我单击该事件时,它将在特定的Event_detail页面上重定向。
我是Laravel的初学者,所以请您帮助我?
这是我的控制器文件
<?php
namespace AppHttpControllersAdmin;
use Carbon;
use Calendar;
use AppEvent;
use IlluminateHttpRequest;
use AppHttpControllersController;
class CalendarController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/*
*Display All The Events In Calendar
*
*/
public function calendar()
{
$event = [];
$allEvent = Event::all();
if($allEvent->count())
{
foreach ($allEvent as $key => $eventList)
{
$event[] = Calendar::event(
$eventList->name,
true,
new DateTime($eventList->event_date),
new DateTime($eventList->evet_date)
);
}
}
$showInCalendar = Calendar::addEvents($event);
return view('admin.calendar.event_calendar', compact('showInCalendar', 'allEvent'));
}
}
这是MUY刀片文件
@extends('admin.layout.default')
@section('css')
<link href="{{ url('assets/plugins/calendar/dist/fullcalendar.css') }}" rel="stylesheet" />
@endsection
@section('content')
<div class="row page-titles">
<div class="col-md-5 col-8 align-self-center">
<h3 class="text-themecolor">Calendar</h3>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ url('/home') }}">Dashboard</a></li>
<li class="breadcrumb-item active">Calendar</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="card card-outline-info">
<div class="card-body">
<div class="container">
<div class="row justify-content-center">
<div id="calendar">
{!! $showInCalendar->calendar() !!}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('jsPostApp')
{!! $showInCalendar->script() !!}
<script src="{{ url('assets/plugins/calendar/jquery-ui.min.js') }}"></script>
<script src="{{ url('assets/plugins/moment/moment.js') }}"></script>
<script src="{{ url('assets/plugins/calendar/dist/fullcalendar.min.js') }}"></script>
<script type="text/javascript">
</script>
@endsection
我不知道如何处理超链接以打开特定事件的替代页面。
实现这种行为非常容易。
您需要在事件对象中设置属性URL。拥有后,您可以使用回调EventClick重定向用户。默认情况下,eventClick
将始终重定向到url
内的链接。
如果要在其他选项卡或弹出窗口中显示它
owk我得到了解决方案
public function calendar()
{
$event = [];
$allEvent = Event::all();
if($allEvent->count())
{
foreach ($allEvent as $key => $eventList)
{
$event[] = Calendar::event(
$eventList->name,
true,
new DateTime($eventList->event_date),
new DateTime($eventList->event_date),
null,
[
'url' => 'event/' .$eventList->id,
]
);
}
}