当前位置: 首页>>代码示例>>PHP>>正文


PHP Group::FindOrFail方法代码示例

本文整理汇总了PHP中app\Group::FindOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::FindOrFail方法的具体用法?PHP Group::FindOrFail怎么用?PHP Group::FindOrFail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Group的用法示例。


在下文中一共展示了Group::FindOrFail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: destroy

 public function destroy($id)
 {
     $group = \App\Group::FindOrFail($id);
     $group->delete();
     \Session::flash('flash_message', 'Group has been deleted.');
     return redirect('groups');
 }
开发者ID:romulodl,项目名称:swim,代码行数:7,代码来源:GroupController.php

示例2: storeNoRedirect

 public function storeNoRedirect(Request $request)
 {
     $this->validate($request, ['name' => 'required|max:64', 'date' => 'required|date_format:d.m.Y|after:' . Carbon::now(), 'time' => 'required|date_format:H:i', 'place' => 'required|max:128']);
     $event = new Event();
     $event->name = $request->input('name');
     $event->time = Carbon::createFromFormat('d.m.Y H:i', $request->input('date') . ' ' . $request->input('time'));
     $event->place = $request->input('place');
     $event->description = $request->input('description');
     $event->group_id = $request->input('groupId');
     $group = Group::FindOrFail($request->input('groupId'));
     if (Gate::allows('manageForGroup', $group)) {
         $days = collect($request->input('days'));
         $date = Carbon::createFromFormat('d.m.Y', $request->input('date'));
         $endDate = $date->copy();
         $startDate = $date->copy();
         $interval = $request->input('interval');
         if ($request->input('repeat') != NULL) {
             $ending = $request->input('ending');
             $endDate = $ending == "afterYear" ? $endDate->addYear() : Carbon::createFromFormat('d.m.Y', $request->input('endDate'));
         }
         $event->endDate = $endDate;
         $event->save();
         do {
             if ($days->contains($date->dayOfWeek) && $startDate->diffInWeeks($date) % $interval == 0 || $request->input('repeat') == NULL) {
                 $occurrence = new EventOccurrence();
                 $occurrence->event_id = $event->id;
                 $occurrence->date = $date;
                 $occurrence->save();
             }
             $date->addDay();
         } while ($date < $endDate);
         return redirect('activity_planning/planner');
     } else {
         return abort(403);
     }
 }
开发者ID:partio-scout,项目名称:kokous_backend,代码行数:36,代码来源:EventController.php


注:本文中的app\Group::FindOrFail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。