示例#1
0
 /**
  * Display a list of all of the user's events.
  *
  * @param Request $request
  * @return Response
  */
 public function index(Request $request)
 {
     $events = $this->events->findAllEventsForUser($request->user());
     foreach ($events as &$event) {
     }
     return view('events.index', ['events' => $events]);
 }
 /**
  * Creates a new report on the specified event.
  *
  * @param ReportRequest $request
  * @param int|string    $eventId
  *
  * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
  */
 public function store(ReportRequest $request, $eventId)
 {
     $report = $this->event->createReport($request, $eventId);
     if ($report) {
         $message = 'Successfully created event report.';
         return redirect()->route('maintenance.events.show', [$eventId, '#tab-report'])->withSuccess($message);
     } else {
         $message = 'There was an issue creating a report for this event. Please try again.';
         return redirect()->route('maintenance.events.show', [$eventId, '#tab-report'])->withErrors($message);
     }
 }
示例#3
0
 /**
  * 删除旧菜单.
  *
  * @param int $accountId 公众号id
  */
 public function destroyMenu($accountId)
 {
     $menus = $this->all($accountId);
     array_map(function ($menu) {
         if ($menu['type'] == 'click') {
             $this->eventRepository->distoryByEventKey($menu['key']);
         }
     }, $menus);
     $this->model->where('account_id', $accountId)->delete();
 }
示例#4
0
 /**
  * Deletes the specified event.
  *
  * @param int|string $id
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function destroy($id)
 {
     if ($this->event->delete($id)) {
         $message = 'Successfully deleted event';
         return redirect()->route('maintenance.events.index')->withSuccess($message);
     } else {
         $message = 'There was an error trying to delete this event. Please try again.';
         return redirect()->route('maintenance.events.show', [$id])->withErrors($message);
     }
 }
示例#5
0
 /**
  * Reschedule a given event.
  *
  * @param  Request $request
  * @param  int $id
  * @return \Illuminate\View\View|\Illuminate\Http\RedirectResponse
  */
 public function postReschedule(StoreEventFormRequest $request, $id)
 {
     $event = Event::findOrFail($id);
     // Check if the user is allowed to reschedule this event
     $this->authorize('reschedule', $event);
     $input = $request->only(['event.title', 'event.type_id', 'event.start_at', 'event.description', 'venue.name', 'venue.lat', 'venue.lng', 'venue.address', 'venue.url']);
     $this->eventRepository->reschedule($event, $input);
     $this->flashSuccess(trans('messages.event.created', ['title' => $event->present()->title()]));
     return response()->json();
 }
 /**
  * Deletes the specified event attached to the specified eventable.
  *
  * @param int|string $resourceId
  * @param int|string $eventId
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function destroy($resourceId, $eventId)
 {
     $eventable = $this->getEventableRepository()->model()->findOrFail($resourceId);
     if (method_exists($eventable, 'events')) {
         $event = $eventable->events()->find($eventId);
         if ($event && $this->event->delete($event->id)) {
             $message = 'Successfully deleted event.';
             return redirect()->route($this->routes['index'], $eventable->id)->withSuccess($message);
         } else {
             $message = 'There was an issue deleting this event. Please try again.';
             return redirect()->route($this->routes['show'], $eventable->id, $event->id)->withErrors($message);
         }
     }
     abort(404);
 }
示例#7
0
文件: Event.php 项目: 90door/viease
 /**
  * 创建一个mediaId类型的回复事件
  *
  * @param  string $materialId 原始图片素材Id
  *
  * @return string 事件key
  */
 public function makeMediaId($materialId)
 {
     $mediaId = $this->materialService->localizeInterimMaterialId($materialId);
     return $this->eventRepository->storeMaterial($mediaId);
 }