本文整理汇总了PHP中app\Group类的典型用法代码示例。如果您正苦于以下问题:PHP Group类的具体用法?PHP Group怎么用?PHP Group使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Group类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:philippejadin,项目名称:Mobilizator,代码行数:26,代码来源:ActionController.php
示例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;
}
开发者ID:jtoshmat,项目名称:laravel,代码行数:26,代码来源:Group.php
示例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
}
开发者ID:machiidev,项目名称:lapp1,代码行数:34,代码来源:GroupController.php
示例4: listAuths
public function listAuths($description)
{
if (!isset($description)) {
return "bad";
}
$group = new Group();
return $group->auths($description);
}
开发者ID:marcocastignoli,项目名称:lumen_auth,代码行数:8,代码来源:GroupController.php
示例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);
}
开发者ID:kocsenc,项目名称:api,代码行数:13,代码来源:GroupTableSeeder.php
示例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;
}
开发者ID:partio-scout,项目名称:kokous_backend,代码行数:9,代码来源:ActivityViewTest.php
示例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');
}
开发者ID:Jessehuze,项目名称:se-group8,代码行数:11,代码来源:PagesController.php
示例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');
}
开发者ID:partio-scout,项目名称:kokous_backend,代码行数:11,代码来源:GroupViewTest.php
示例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);
}
开发者ID:philippejadin,项目名称:Mobilizator,代码行数:14,代码来源:MapController.php
示例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]);
}
开发者ID:philippejadin,项目名称:Mobilizator,代码行数:20,代码来源:DiscussionController.php
示例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'));
}
开发者ID:Jemok,项目名称:skoolspace,代码行数:12,代码来源:FollowController.php
示例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)]);
}
}
开发者ID:mathijsjansen1987,项目名称:mytrainr_backend,代码行数:7,代码来源:GroupsTableSeeder.php
示例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"]);
}
开发者ID:R3Moura,项目名称:Rede-Encontrista,代码行数:32,代码来源:GroupSeed.php
示例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'));
}
开发者ID:nayed,项目名称:Project-007,代码行数:13,代码来源:UserController.php
示例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);
});
}
开发者ID:mario650mm,项目名称:Permisos,代码行数:13,代码来源:AuthServiceProvider.php
示例16: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
// we expect a url in the form /groups/{group_id}
if ($request->segment(1) == 'groups') {
if ($this->auth->guest()) {
$group = \App\Group::findOrFail($request->segment(2));
if ($group->isPublic()) {
return $next($request);
} else {
return redirect()->back()->with('message', trans('messages.not_allowed'));
}
} else {
$group = \App\Group::findOrFail($request->segment(2));
if ($group->isPublic()) {
return $next($request);
} elseif ($group->isMember()) {
return $next($request);
} elseif ($request->user()->isAdmin()) {
return $next($request);
// user is admin, and sees everything, fine (at least in sync with current policies for admins)
} else {
return redirect()->back()->with('message', trans('messages.not_allowed'));
}
}
} else {
return redirect()->back()->with('message', 'Are you in a group at all !? (url doesnt start with group/something). This is a bug');
}
}
开发者ID:philippejadin,项目名称:Mobilizator,代码行数:36,代码来源:RedirectIfNotGroupMemberOrPublicGroup.php
示例17: handle
/**
* Execute the job.
*
* @return void
*/
public function handle(Mailer $mail)
{
$group = $this->ticket->group_id;
$customers = Group::where('id', $group)->first()->customers()->get();
$_customers = [];
foreach ($customers as $customer) {
$_customers[] = $customer->id;
}
$sys_name = Settings::where('name', 'sys_name')->first();
$user = User::whereIn('customer_id', $_customers)->get();
foreach ($user as $_user) {
$mail->send('emails.updateticket', ['user' => $_user, 'ticket' => $this->ticket, 'response' => $this->response, 'sys_name' => $sys_name], function ($m) use($_user) {
$m->to($_user->email, $_user->first_name . ' ' . $_user->last_name)->subject('Ticket updated - ' . $this->ticket->track_id . ' [' . $this->ticket->status->name . ']');
if (count($this->response->attachments()->get()) > 0) {
foreach ($this->response->attachments as $attachment) {
$m->attach(storage_path() . '/attachments/' . $this->ticket->id . '/' . $attachment->name);
}
}
});
}
// Cleanup variables
unset($this->ticket);
unset($this->response);
unset($group);
unset($customers);
unset($user);
unset($sys_name);
unset($_customers);
}
开发者ID:stryker250,项目名称:simple_ticket,代码行数:34,代码来源:EmailUpdatedTicket.php
示例18: index
public function index()
{
$groups = Group::with(['users' => function ($query) {
$query->where('active', 1);
}])->orderBy('name', 'ASC')->get();
return view('index', compact('groups'));
}
开发者ID:mauri870,项目名称:groups-and-users,代码行数:7,代码来源:HomeController.php
示例19: testUserCanBeRemovedFromTheGroup
public function testUserCanBeRemovedFromTheGroup()
{
$this->logIn();
$group = new Group();
$group->name = 'TestiRyhmä';
$group->scout_group = 'Lippukunta';
$group->age_group = 'Ikäryhmä';
$group->save();
$user = new User();
$user->id = '23';
$user->membernumber = '2312334212';
$user->firstname = 'Liisa';
$user->lastname = 'Saarenmaa';
$user->save();
$this->visit('/groups/1/users')->press('Lisää ryhmän jäsen')->see('Liisa')->press('Poista')->dontSee('Poista');
}
开发者ID:partio-scout,项目名称:kokous_backend,代码行数:16,代码来源:GroupUserViewTest.php
示例20: getAssignedGroupsToProject
public function getAssignedGroupsToProject($projectId)
{
$groups = Group::whereHas('projects', function ($q) use($projectId) {
$q->where('project_id', $projectId);
})->paginate(5);
return $groups;
}
开发者ID:jtrupina,项目名称:mobile-app-challenge-2015-web,代码行数:7,代码来源:GroupRepository.php
注:本文中的app\Group类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论