本文整理汇总了PHP中app\Group类的典型用法代码示例。如果您正苦于以下问题:PHP Group类的具体用法?PHP Group怎么用?PHP Group使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Group类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: updateGroups
public static function updateGroups(Request $request)
{
$titles = $request::get('title');
$ids = $request::get('id');
$deleteId = $request::get('delete');
$newtitle = $request::get('newtitle');
$i = 0;
if ($ids) {
foreach ($ids as $id) {
$group = Group::find($id);
$group->title = $titles[$i];
if (isset($deleteId[$i]) && $deleteId[$i] == $id) {
$group->delete();
} else {
$group->save();
}
$i++;
}
}
if ($newtitle) {
$group = new Group();
$group->title = $newtitle;
$group->save();
}
return true;
}
示例3: axsave
public function axsave(Request $request)
{
//
$response = array('status' => 'success', 'msg' => 'OK!');
$rules = array('fname' => 'required', 'fremark' => 'required', 'femail' => 'required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
$response['status'] = "warning";
$response['msg'] = $validator->messages()->toJson();
return response()->json($response);
} else {
try {
$gid = Input::get('fid');
if ($gid != 'Neu') {
$group = Group::find($gid);
} else {
$group = new Group();
}
$group->name = Input::get('fname');
$group->remark = Input::get('fremark');
$group->email = Input::get('femail');
//$user = \App\User::find(1) ;
$group->manager()->associate(Input::get('fmanager'));
$group->save();
} catch (\Illuminate\Database\QueryException $e) {
$response['status'] = "danger";
$response['msg'] = "Database error: " . $e->getMessage();
return response()->json($response);
}
//return Response::json( $response );
return response()->json($response);
}
//validatorf
}
示例4: listAuths
public function listAuths($description)
{
if (!isset($description)) {
return "bad";
}
$group = new Group();
return $group->auths($description);
}
示例5: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$group = new Group();
$group->name = 'Projects';
$group->officer_id = 1;
$group->save();
$group->members()->attach(1);
}
示例6: createTestGroup
private static function createTestGroup()
{
$group = new Group();
$group->name = 'Test123';
$group->scout_group = 'Test_group123';
$group->age_group = 'sudenpennut';
$group_id = $group->save();
return $group_id;
}
示例7: createGroup
public function createGroup(Request $request)
{
$user = Auth::user();
$group = new Group();
$group->gname = $request->input('gname');
$group->user_id = $user->id;
$group->save();
$group->members()->attach(array($user->id));
//Adds user as member of group
return Redirect::action('PagesController@dashboard');
}
示例8: testGroupCanBeDeleted
public function testGroupCanBeDeleted()
{
$this->logIn();
session()->set('admin', 1);
$group = new Group();
$group->name = 'RyhmäA';
$group->scout_group = 'Lippulaiset';
$group->age_group = 'Vuotiaat';
$group->save();
$this->visit('/groups/1')->press('Poista')->seePageIs('/groups')->dontSee('RyhmäA');
}
示例9: 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);
}
示例10: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request, Group $group)
{
$discussion = new Discussion();
$discussion->name = $request->input('name');
$discussion->body = $request->input('body');
$discussion->total_comments = 1;
// the discussion itself is already a comment
$discussion->user()->associate(Auth::user());
if (!$group->discussions()->save($discussion)) {
// Oops.
return redirect()->action('DiscussionController@create', $group->id)->withErrors($discussion->getErrors())->withInput();
}
flash()->info(trans('messages.ressource_created_successfully'));
return redirect()->action('DiscussionController@show', [$group->id, $discussion->id]);
}
示例11: create
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
$title = 'Join a new group';
$groups = Group::allPaginatedGroups();
$tagline = "Join a New Group";
return view('inspina.groups.search', compact('groups', 'title', 'tagline'));
}
示例12: run
public function run()
{
$faker = Faker::create();
foreach (range(0, 30) as $index) {
Group::create(['name' => $faker->sentence(1), 'sport_id' => $faker->biasedNumberBetween(0, 10), 'description' => $faker->sentence(10)]);
}
}
示例13: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Group::create(["designation" => "Buraca02", "localization" => "Buraca", "creation_date" => "37262"]);
Group::create(["designation" => "Buraca04", "localization" => "Buraca", "creation_date" => "38333"]);
Group::create(["designation" => "Buraca08", "localization" => "Buraca", "creation_date" => "39425"]);
Group::create(["designation" => "Buraca12", "localization" => "Buraca", "creation_date" => "40965"]);
Group::create(["designation" => "Cacem10", "localization" => "Cacem", "creation_date" => "40195"]);
Group::create(["designation" => "Caparide07", "localization" => "Tires", "creation_date" => "39131"]);
Group::create(["designation" => "Entroncamento13", "localization" => "Entroncamento", "creation_date" => "41294"]);
Group::create(["designation" => "Laranjeiras09", "localization" => "Laranjeiras", "creation_date" => "39873"]);
Group::create(["designation" => "Lavradio07", "localization" => "Lavradio", "creation_date" => "41315"]);
Group::create(["designation" => "Loures10", "localization" => "Loures", "creation_date" => "40216"]);
Group::create(["designation" => "Madrona05 e Tires05", "localization" => "Madorna", "creation_date" => "38389"]);
Group::create(["designation" => "MtA10", "localization" => "MtA", "creation_date" => "40216"]);
Group::create(["designation" => "RM07", "localization" => "RM", "creation_date" => "39425"]);
Group::create(["designation" => "SDR03", "localization" => "SDR", "creation_date" => "37633"]);
Group::create(["designation" => "SDR10", "localization" => "SDR", "creation_date" => "40153"]);
Group::create(["designation" => "SJB08", "localization" => "SJB", "creation_date" => "39509"]);
Group::create(["designation" => "SJB12", "localization" => "SJB", "creation_date" => "40965"]);
Group::create(["designation" => "Tires05", "localization" => "Tires", "creation_date" => "38382"]);
Group::create(["designation" => "VN08", "localization" => "VN", "creation_date" => "39138"]);
Group::create(["designation" => "VN11", "localization" => "VN", "creation_date" => "40587"]);
Group::create(["designation" => "Cacem08", "localization" => "Cacem", "creation_date" => "25569"]);
Group::create(["designation" => "CAboboda14", "localization" => "Conceição da Aboboda", "creation_date" => "41672"]);
Group::create(["designation" => "SJB14", "localization" => "SJB", "creation_date" => "41665"]);
Group::create(["designation" => "VN14", "localization" => "VN", "creation_date" => "41679"]);
}
示例14: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$user = User::findOrFail($id);
$groups = Group::all(['id', 'name']);
$categories = Category::all(['id', 'name']);
return view('users.edit', compact('user', 'groups', 'categories'));
}
示例15: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
$this->registerPolicies($gate);
$gate->define('update-general', function ($user, $model) {
return Group::perm_update($user, $model);
});
}