本文整理汇总了PHP中app\models\Group::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::where方法的具体用法?PHP Group::where怎么用?PHP Group::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Group
的用法示例。
在下文中一共展示了Group::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: putVerify
public function putVerify($groupId)
{
$this->beforeFilter('admin');
$newGroup = (object) Input::all();
if (!Group::isValidStatus($newGroup->status)) {
throw new \Exception("Invalid value for verify request");
}
$group = Group::where('id', '=', $groupId)->first();
if (!$group) {
throw new \Exception("Invalid Group");
}
$group->status = $newGroup->status;
DB::transaction(function () use($group) {
$group->save();
switch ($group->status) {
case Group::STATUS_ACTIVE:
$group->createRbacRules();
break;
case Group::STATUS_PENDING:
$group->destroyRbacRules();
break;
}
});
return Response::json($group);
}
示例2: portfolioItem
public function portfolioItem($groupLink, $id)
{
$group = Group::where('link', '=', $groupLink)->firstOrFail();
$portfolios = PortfolioRepository::byGroup($groupLink);
$view = Agent::isTablet() || Request::has('t') ? 'tablet.portfolio_item' : (Agent::isMobile() || Request::has('m') ? 'mobile.portfolio_item' : 'index.portfolio_item');
return view($view, array('group' => $group, 'portfolios' => $portfolios, 'id' => $id, 'title' => $group->title . ' | TWIGA'));
}
示例3: run
public function run()
{
$adminEmail = Config::get('madison.seeder.admin_email');
$adminPassword = Config::get('madison.seeder.admin_password');
// Login as admin to create docs
$credentials = array('email' => $adminEmail, 'password' => $adminPassword);
Auth::attempt($credentials);
$admin = Auth::user();
$group = Group::where('id', '=', 1)->first();
// Create first doc
$docSeedPath = app_path() . '/database/seeds/example.md';
if (file_exists($docSeedPath)) {
$content = file_get_contents($docSeedPath);
} else {
$content = "New Document Content";
}
$docOptions = array('title' => 'Example Document', 'content' => $content, 'sponsor' => $group->id, 'publish_state' => 'published', 'sponsorType' => Doc::SPONSOR_TYPE_GROUP);
$document = Doc::createEmptyDocument($docOptions);
//Set first doc as featured doc
$featuredSetting = new Setting();
$featuredSetting->meta_key = 'featured-doc';
$featuredSetting->meta_value = $document->id;
$featuredSetting->save();
// Create second doc
$docSeedPath = app_path() . '/database/seeds/example2.md';
if (file_exists($docSeedPath)) {
$content = file_get_contents($docSeedPath);
} else {
$content = "New Document Content";
}
$docOptions = array('title' => 'Second Example Document', 'sponsor' => $group->id, 'publish_state' => 'published', 'sponsorType' => Doc::SPONSOR_TYPE_GROUP);
$document = Doc::createEmptyDocument($docOptions);
}
示例4: run
public function run()
{
$person = DB::table('people')->where('first_name', 'James')->where('last_name', 'Sample')->first();
$company = Company::where('name', 'Sample Company')->first();
$group_type = GroupType::where('name', 'employee')->first();
$group = Group::where('name', 'e80-helpdesk')->first();
if (isset($person)) {
CompanyPerson::create(['person_id' => $person->id, 'company_id' => $company->id, 'group_type_id' => $group_type->id, 'group_id' => $group->id]);
}
}
示例5: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index($society)
{
if (Helpers::perm('admin', $society) or Helpers::perm('edit', $society)) {
$data['society'] = $society;
$data['groups'] = Group::where('society_id', '=', $society)->orderBy('subcategory')->orderBy('groupname')->get();
return View::make('groups.index', $data);
} else {
return View::make("shared.unauthorised");
}
}
示例6: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @returnpResponse
*/
public function edit($society, $hid, $id)
{
if (Helpers::perm('admin', $society) or Helpers::perm('edit', $society)) {
$pastoral = Pastoral::find($id);
$pgid = Helpers::societySetting('group_pastors', $society);
$addressee = Household::find($pastoral->household_id)->addressee;
$pastorgroup = Group::where('id', '=', $pgid)->with('individual')->get();
$pastors = array();
foreach ($pastorgroup[0]->individual as $user) {
$pastors[$user->id] = $user->surname . ", " . $user->firstname;
}
return View::make('pastorals.edit')->with('pastoral', $pastoral)->with('addressee', $addressee)->with('pastors', $pastors)->with('society', $society);
} else {
return view('shared.unauthorised');
}
}
示例7: scopeFromGroup
/**
* Scope a query to only include users that belong to a specific group
*
* @param $query
* @param $group
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeFromGroup($query, $group)
{
if (is_string($group)) {
$group = Models\Group::where('name', '=', $group)->first();
}
return $query->whereHas('groups', function ($q) use($group) {
$q->where('name', $group->name);
});
}
示例8: dashboard
public function dashboard($society)
{
$data['total_indivs'] = Individual::socindiv($society)->count();
$data['total_households'] = Household::where('society_id', '=', $society)->count();
$data['missing_gps'] = Household::where('society_id', '=', $society)->where('latitude', '=', null)->count();
$data['missing_hc'] = Household::where('society_id', '=', $society)->where('householdcell', '=', '')->count();
$data['missing_pa'] = Household::where('society_id', '=', $society)->where('addr1', '=', '')->count();
$data['members'] = Individual::socindiv($society)->members()->count();
$data['children'] = Individual::socindiv($society)->children()->count();
$totaged = Individual::socindiv($society)->members()->get();
$totnum = 0;
$totyr = 0;
foreach ($totaged as $thisa) {
if ($thisa->age) {
$totyr = $totyr + $thisa->age;
$totnum++;
}
}
$data['missing_bd'] = Individual::socindiv($society)->members()->where('birthdate', '<', '1901-01-01')->count();
if ($totnum) {
$data['avg_age'] = round($totyr / $totnum, 1);
}
$data['fellowship'] = Individual::socindiv($society)->members()->whereHas('group', function ($query) {
$query->where('grouptype', '=', 'fellowship');
})->count();
$data['service'] = Individual::socindiv($society)->members()->whereHas('group', function ($query) {
$query->where('grouptype', '=', 'service');
})->count();
$data['worship'] = Individual::socindiv($society)->members()->whereHas('group', function ($query) {
$query->where('grouptype', '=', 'worship');
})->count();
$data['learning'] = Individual::socindiv($society)->members()->whereHas('group', function ($query) {
$query->where('grouptype', '=', 'learning');
})->count();
$data['groups'] = Group::where('society_id', '=', $society)->where('statistics', '=', 'yes')->orderBy('groupname')->get();
$data['society'] = $society;
//$data['analyticsData'] = LaravelAnalytics::getVisitorsAndPageViews(7);
return view('statistics.dashboard', $data);
}
示例9: installSave
//.........这里部分代码省略.........
$table->string('RecyclePool')->nullable();
$table->string('RecycleOldestVolume')->nullable();
$table->string('RecycleCurrentVolume')->nullable();
$table->string('Recycle')->nullable();
$table->string('PurgeOldestVolume')->nullable();
$table->string('FileRetention')->nullable();
$table->string('JobRetention')->nullable();
$table->string('CleaningPrefix')->nullable();
$table->string('LabelFormat')->nullable();
});
}
/* cfgschedule */
if (!Schema::hasTable('cfgschedule')) {
Schema::create('cfgschedule', function ($table) {
$table->increments('id');
$table->string('Name')->nullable();
$table->string('Run')->nullable();
});
}
/* cfgscheduleRun */
if (!Schema::hasTable('cfgschedulerun')) {
Schema::create('cfgschedulerun', function ($table) {
$table->increments('id');
$table->string('idschedule')->nullable();
$table->string('Run')->nullable();
});
}
/* cfgstorage */
if (!Schema::hasTable('cfgstorage')) {
Schema::create('cfgstorage', function ($table) {
$table->increments('id');
$table->string('Name')->nullable();
$table->string('Run')->nullable();
$table->string('SDPort')->nullable();
$table->string('Password')->nullable();
$table->string('Device')->nullable();
$table->string('MediaType')->nullable();
$table->string('Autochanger')->nullable();
$table->string('MaximumConcurrentJobs')->nullable();
$table->string('AllowCompression')->nullable();
$table->string('HeartbeatInterval')->nullable();
$table->string('Address')->nullable();
});
}
/* daystats */
if (!Schema::hasTable('daystats')) {
Schema::create('daystats', function ($table) {
$table->increments('id');
$table->timestamp('data')->nullable();
$table->string('server')->nullable();
$table->bigInteger('bytes')->nullable();
$table->bigInteger('files')->nullable();
$table->integer('clients')->nullable();
$table->bigInteger('databasesize')->nullable();
});
}
/* hoursstats */
if (!Schema::hasTable('hoursstats')) {
Schema::create('hoursstats', function ($table) {
$table->increments('id');
$table->timestamp('data')->nullable();
$table->string('server')->nullable();
$table->timestamp('starttime')->nullable();
$table->timestamp('endtime')->nullable();
$table->bigInteger('bytes')->nullable();
$table->bigInteger('hoursdiff')->nullable();
$table->double('hourbytes')->nullable();
$table->string('timediff')->nullable();
});
}
//Group::where('name', '=', 'Admins')->count();
//var_dump ($count);
/* If Not Found Create Admin Group */
if (!Group::where('name', '=', 'Admins')->count()) {
$group = Sentry::createGroup(array('name' => 'Admins', 'permissions' => array('admin' => 1, 'users' => 1)));
} else {
$group = Sentry::findGroupByName('Admins');
}
// Create User
if (!User::where('email', '=', Input::get('email'))->count()) {
$user = Sentry::createUser(array('email' => Input::get('email'), 'password' => Input::get('password'), 'activated' => '1'));
$user->addGroup($group);
}
/* Emails Tables */
if (Schema::hasTable('emails') == false) {
Schema::create('emails', function ($table) {
$table->increments('id');
$table->text('emails');
$table->text('clients')->nullable();
$table->text('jobs')->nullable();
$table->text('when')->nullable();
});
}
echo json_encode(array('location' => 'install/installSucess'));
} catch (Sentry\SentryException $e) {
// $errors = new Laravel\Messages();
Session::flash('status_error', $e->getMessage());
return Redirect::to('install')->with_errors($validation);
}
}
示例10: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
if (Helpers::perm('admin', $id)) {
$data['page_title'] = "Edit society";
$data['page_description'] = Helpers::getSetting('circuit_name') . " Circuit";
$data['society'] = Society::with('service')->find($id);
$data['latitude'] = $data['society']->latitude;
$data['longitude'] = $data['society']->longitude;
$data['indivs'] = Individual::socindiv($data['society']->id)->get();
$data['groups'] = Group::where('society_id', '=', $data['society']->id)->orderBy('groupname')->get();
$data['rosters'] = Roster::where('society_id', '=', $data['society']->id)->orderBy('rostername')->get();
$data['provideropts'] = array('none' => '', 'bulksms' => 'Bulk SMS', 'smsfactory' => 'SMS Factory');
return View::make('societies.edit', $data);
} else {
return view('shared.unauthorised');
}
}
示例11: compose
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
$society = $view->getData()['soc'];
$data['services'] = Society::with('service')->where('society', '=', $society)->first();
foreach ($data['services']->service as $service) {
if ($service['language'] == "English" and $service['description'] == "") {
$service->description = "Our " . $service->servicetime . " service is led in English by a minister or local preacher and a team of musicians. Everyone is welcome!";
} elseif ($service['language'] == "isiZulu" and $service['description'] == "") {
$service->description = "Our " . $service->servicetime . " service is led in isiZulu by a minister or local preacher and uses the liturgy and music of the Methodist Hymn Book. Everyone is welcome!";
}
$data['allservices'][] = $service;
}
if (!count($data['services'])) {
return View::make('errors.404');
}
if (isset($view->getData()['pagetitle'])) {
$data['pagetitle'] = $view->getData()['pagetitle'];
} else {
$data['pagetitle'] = $society;
}
$socid = Society::where('society', '=', $society)->select('id')->first()->id;
if (Helpers::is_online() and $data['services']->society_calendar != "") {
$privatecal = new GoogleCalendar();
$data['cals'] = $privatecal->getTen($data['services']->society_calendar, 8);
}
$data['sermon'] = Sermon::with(['series' => function ($query) use($socid) {
$query->where('society_id', '=', $socid);
}])->orderBy('servicedate', 'DESC')->first();
if (!$data['sermon'] or !$data['sermon']->series) {
$data['sermon'] = "None";
} else {
if ($data['sermon']->preachable_type == 'App\\Models\\Minister') {
$data['preacher'] = Minister::find($data['sermon']->preachable_id);
} elseif ($data['sermon']->preachable_type == 'App\\Models\\Guest') {
$data['preacher'] = Guest::find($data['sermon']->preachable_id);
} else {
$data['preacher'] = Preacher::find($data['sermon']->preachable_id);
}
}
$data['welcome_page'] = "together a transforming discipleship movement";
$data['welcome_page_pic'] = "/public/images/715.jpg";
if ($data['services']->roster) {
$data['roster'] = $data['services']->roster;
}
$data['society'] = Society::where('society', '=', $society)->first();
if ($data['society']->roster) {
$data['roster'] = $data['society']->roster;
}
$webpage = Webpage::where('society_id', '=', $data['society']->id)->get();
foreach ($webpage as $pg) {
$data[$pg->fieldname] = $pg->fieldvalue;
$data[$pg->fieldname . '_pic'] = $pg->pageimage;
}
$data['route'] = Route::getCurrentRoute()->getPath();
if ($data['route'] != "{society}" and $data['route'] != "/") {
$linkadd = Helpers::makeUrl(strtolower($society), '');
} else {
$linkadd = "";
}
$menu['link'] = $linkadd . "#sundays";
$menu['label'] = "Sundays";
$menu['longlabel'] = "Sunday services";
$data['menu'][] = $menu;
$data['youth'] = Mission::where('society_id', '=', $data['society']->id)->where('category', '=', 'youth')->orderBy('created_at')->take(5)->get();
if (count($data['youth'])) {
$menu['link'] = $linkadd . "#youth";
$menu['label'] = "Youth";
$menu['longlabel'] = "Children and Youth";
$data['menu'][] = $menu;
}
$data['groups'] = Group::where('society_id', '=', $data['society']->id)->where('publish', '=', 1)->get();
if (count($data['groups'])) {
foreach ($data['groups'] as $obj) {
$dum[0] = $obj->groupname;
$dum[1] = $obj->latitude;
$dum[2] = $obj->longitude;
$dum[3] = Helpers::makeUrl(strtolower($data['services']->society), 'groups/' . $obj->slug);
$fin[] = $dum;
}
$data['fin'] = json_encode($fin);
$menu['link'] = "#groups";
$menu['label'] = "Groups";
$menu['longlabel'] = "Small groups";
$data['menu'][] = $menu;
} else {
$data['fin'] = "";
}
$data['missions'] = Mission::where('society_id', '=', $data['society']->id)->where('category', '=', 'project')->take(5)->get();
if (count($data['missions'])) {
$menu['link'] = $linkadd . "#projects";
$menu['label'] = "Projects";
$menu['longlabel'] = "Mission projects";
$data['menu'][] = $menu;
}
//.........这里部分代码省略.........
示例12: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($society, $hid, $id)
{
if (Helpers::perm('admin', $society) or Helpers::perm('edit', $society)) {
$data['society'] = $society;
$data['individual'] = Individual::with('group', 'skill')->find($id);
if (!$data['individual']->photo) {
$data['individual']->photo = "/public/images/profile.png";
}
if (count($data['individual']->currentgroups) != 0) {
foreach ($data['individual']->currentgroups as $group) {
$groupmembers[] = $group->id;
}
$data['groupmembers'] = $groupmembers;
}
$data['groups'] = Group::where('society_id', '=', $society)->orderBy('groupname')->get();
if (count($data['individual']->skill) != 0) {
foreach ($data['individual']->skill as $skill) {
$skillmembers[] = $skill->id;
}
$data['skillmembers'] = $skillmembers;
}
$data['household_id'] = $data['individual']->household_id;
$data['skills'] = Skill::orderBy('skill')->get();
$data['pgadmin'] = Society::find($society)->pgadmin;
return View::make('individuals.edit', $data);
} else {
//
}
}
示例13: getEdit
public function getEdit($groupId = null)
{
if (!Auth::check()) {
return Redirect::to('user/login')->with('error', 'Please log in to edit a group');
}
if (is_null($groupId)) {
$group = new Group();
} else {
$group = Group::where('id', '=', $groupId)->first();
if (!$group) {
return Redirect::back()->with('error', "Group Not Found");
}
if (!$group->isGroupOwner(Auth::user()->id)) {
return Redirect::back()->with('error', 'You cannot edit the group you are not the owner');
}
}
return View::make('groups.edit.index', compact('group'));
}
示例14: _covenant
private function _covenant($society, $blank = "false")
{
$pdf = new Fpdf();
$soc = Society::find($society);
if (!$blank) {
$households = Household::with('individual')->where('society_id', '=', $society)->orderBy('sortsurname')->get();
if ($soc->logo == "") {
$logopath = base_path() . '/public/images/defaultlogo.jpg';
} else {
$logopath = base_path() . '/public/images/defaultlogo.jpg';
}
} else {
$individual = (object) ['firstname' => 'Name:', 'surname' => '', 'memberstatus' => 'member', 'title' => '', 'birthdate' => '', 'cellphone' => '', 'email' => '', 'giving' => '', 'group' => array()];
$individuals[] = $individual;
$individuals[] = $individual;
$individuals[] = $individual;
$household = (object) ['addressee' => 'Household:', 'addr1' => '', 'addr2' => '', 'addr3' => '', 'post1' => '', 'post2' => '', 'post3' => '', 'homephone' => '', 'householdcell' => '', 'individual' => $individuals];
$households[] = $household;
}
$churchname = $soc->society . " Methodist Church";
foreach ($households as $household) {
$pg = 1;
$pdf->AddPage('P');
$pdf->SetAutoPageBreak(0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->text(10, 10, utf8_decode($household->addressee));
$pdf->SetFont('Arial', '', 11);
$pdf->rect(48, 12, 152, 7);
$pdf->text(10, 17, "Physical Address");
if ($household->addr1) {
$addr = $household->addr1;
if ($household->addr2) {
$addr = $addr . ", " . $household->addr2;
if ($household->addr3) {
$addr = $addr . ", " . $household->addr3;
}
}
$pdf->text(50, 17, $addr);
}
$pdf->rect(48, 21, 152, 7);
$pdf->text(10, 26, "Postal Address");
if ($household->addr1) {
$paddr = $household->post1;
if ($household->post2) {
$paddr = $paddr . ", " . $household->post2;
if ($household->post3) {
$paddr = $paddr . ", " . $household->post3;
}
}
$pdf->text(50, 26, $paddr);
}
$pdf->text(10, 35, "Home phone");
$pdf->rect(48, 30, 152, 7);
$pdf->text(10, 44, "Church SMSes go to");
$pdf->rect(48, 40, 152, 7);
$pdf->text(50, 35, substr($household->homephone, 0, 3) . " " . substr($household->homephone, 3, 4) . " " . substr($household->homephone, 7, 3));
if ($household->householdcell != 0 and Individual::where('id', '=', $household->householdcell)->exists()) {
$pdf->text(50, 45, Individual::find($household->householdcell)->firstname);
}
$yy = 54;
foreach ($household->individual as $indiv) {
if ($indiv->memberstatus == "child") {
$threshold = 270;
} else {
$threshold = 210;
}
if ($yy > $threshold) {
$pg++;
$pdf->AddPage('P');
$pdf->SetFont('Arial', 'B', 11);
$pdf->text(10, 10, utf8_decode($household->addressee) . " - page " . $pg);
$yy = 18;
$pdf->SetFont('Arial', '', 11);
}
$starty = $yy;
$pdf->SetFont('Arial', 'B', 11);
$pdf->text(10, $yy, $indiv->title . " " . utf8_decode($indiv->firstname) . " " . utf8_decode($indiv->surname));
$pdf->SetFont('Arial', '', 11);
$pdf->text(100, $yy, "Date of birth");
$pdf->rect(123, $yy - 5, 8, 7);
$pdf->rect(132, $yy - 5, 25, 7);
$pdf->rect(158, $yy - 5, 20, 7);
if ($indiv->birthdate != "0000-00-00" and $indiv->birthdate != "") {
$pdf->text(125, $yy, date("d", strtotime($indiv->birthdate)));
$pdf->text(134, $yy, date("F", strtotime($indiv->birthdate)));
if (substr($indiv->birthdate, 0, 4) != "1900" and substr($indiv->birthdate, 0, 4) != "") {
$pdf->text(163, $yy, date("Y", strtotime($indiv->birthdate)));
} else {
$pdf->SetFont('Arial', '', 7);
$pdf->setxy(178, $yy - 5.2);
$pdf->multicell(23, 2, "Please include year of birth - this is helpful for worship planning");
}
} else {
$pdf->SetFont('Arial', '', 7);
$pdf->setxy(178, $yy - 5.2);
$pdf->multicell(23, 2, "Please include year of birth - this is helpful for worship planning");
}
$pdf->SetFont('Arial', '', 11);
$yy = $yy + 9;
$pdf->text(10, $yy, "Cellphone");
//.........这里部分代码省略.........
示例15: getAllValidSponsors
public static function getAllValidSponsors()
{
$userMeta = UserMeta::where('meta_key', '=', UserMeta::TYPE_INDEPENDENT_SPONSOR)->where('meta_value', '=', 1)->get();
$groups = Group::where('status', '=', Group::STATUS_ACTIVE)->get();
$results = new Collection();
$userIds = array();
foreach ($userMeta as $m) {
$userIds[] = $m->user_id;
}
if (!empty($userIds)) {
$users = User::whereIn('id', $userIds)->get();
foreach ($users as $user) {
$row = array('display_name' => "{$user->fname} {$user->lname}", 'sponsor_type' => 'individual', 'id' => $user->id);
$results->add($row);
}
}
foreach ($groups as $group) {
$row = array('display_name' => $group->display_name, 'sponsor_type' => 'group', 'id' => $group->id);
$results->add($row);
}
return $results;
}