本文整理汇总了PHP中app\Group::actions方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::actions方法的具体用法?PHP Group::actions怎么用?PHP Group::actions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Group
的用法示例。
在下文中一共展示了Group::actions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexJson
public function indexJson(Request $request, Group $group)
{
//dd($request);
// load of actions between start and stop provided by calendar js
if ($request->has('start') && $request->has('end')) {
$actions = $group->actions()->where('start', '>', Carbon::parse($request->get('start')))->where('stop', '<', Carbon::parse($request->get('end')))->orderBy('start', 'asc')->get();
} else {
$actions = $group->actions()->orderBy('start', 'asc')->get();
}
$event = '';
$events = '';
foreach ($actions as $action) {
$event['id'] = $action->id;
$event['title'] = $action->name . ' (' . $group->name . ')';
$event['description'] = $action->body . ' <br/> ' . $action->location;
$event['body'] = $action->body;
$event['summary'] = summary($action->body);
$event['location'] = $action->location;
$event['start'] = $action->start->toIso8601String();
$event['end'] = $action->stop->toIso8601String();
$event['url'] = action('ActionController@show', [$group->id, $action->id]);
$event['color'] = $group->color();
$events[] = $event;
}
return $events;
}
示例2: show
/**
* Display the specified resource.
*
* @param int $id
*
* @return Response
*/
public function show(Group $group)
{
if (Auth::check()) {
$discussions = $group->discussions()->with('user', 'userReadDiscussion')->orderBy('updated_at', 'desc')->limit(5)->get();
} else {
$discussions = $group->discussions()->with('user')->orderBy('updated_at', 'desc')->limit(5)->get();
}
$files = $group->files()->with('user')->orderBy('updated_at', 'desc')->limit(5)->get();
$actions = $group->actions()->where('start', '>=', Carbon::now())->orderBy('start', 'asc')->limit(10)->get();
return view('groups.show')->with('group', $group)->with('discussions', $discussions)->with('actions', $actions)->with('files', $files)->with('tab', 'home');
}
示例3: embed
/**
* Renders a embedable map
*/
public function embed(Group $group)
{
$users = $group->users()->where('latitude', '<>', 0)->get();
$actions = $group->actions()->where('start', '>=', Carbon::now())->where('latitude', '<>', 0)->get();
// randomize users geolocation by a few meters
foreach ($users as $user) {
$user->latitude = $user->latitude + mt_rand(0, 10) / 10000;
$user->longitude = $user->longitude + mt_rand(0, 10) / 10000;
}
return view('groups.map_embed')->with('tab', 'map')->with('group', $group)->with('users', $users)->with('actions', $actions)->with('latitude', 50.8503396)->with('longitude', 4.3517103);
}
示例4: group
/**
* Renders an ical file for a specific group
*/
public function group(Group $group)
{
// 1. Create new calendar
$vCalendar = new \Eluceo\iCal\Component\Calendar(config('app.url'));
$vCalendar->setName(config('mobilizator.name') . ' : ' . $group->name);
$vCalendar->setDescription(summary($group->body, 500));
// returns actions started the last 60 days
$actions = $group->actions()->where('start', '>=', Carbon::now()->subDays(60))->get();
foreach ($actions as $action) {
// 2. Create an event
$vEvent = new \Eluceo\iCal\Component\Event();
$vEvent->setDtStart($action->start);
$vEvent->setDtEnd($action->stop);
$vEvent->setSummary($action->name);
$vEvent->setDescription(summary($action->body), 1000);
$vEvent->setLocation($action->location);
$vEvent->setUrl(action('ActionController@show', [$action->group->id, $action->id]));
$vEvent->setUseUtc(false);
//TODO fixme
$vCalendar->addComponent($vEvent);
}
return response($vCalendar->render())->header('Content-Type', 'text/calendar; charset=utf-8')->header('Content-Disposition', 'attachment; filename="cal.ics"');
}