當前位置: 首頁>>代碼示例>>PHP>>正文


PHP models\Group類代碼示例

本文整理匯總了PHP中app\models\Group的典型用法代碼示例。如果您正苦於以下問題:PHP Group類的具體用法?PHP Group怎麽用?PHP Group使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Group類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: destroy

 /**
  * Delete the specified group
  *
  * @param Group $group
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  * @throws \Exception
  */
 public function destroy(Group $group)
 {
     $this->authorize('edit_users');
     $group->delete();
     flash()->success('Group Deleted', 'The group has been removed');
     return redirect('group');
 }
開發者ID:buys-fran,項目名稱:mtech-mis,代碼行數:14,代碼來源:GroupsController.php

示例2: destroy

 /**
  * @param Group $Group
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function destroy(Group $Group)
 {
     if ($count = $Group->users->count()) {
         return redirect(route('admin.groups.list'))->with('error', "В группе есть пользователи ({$count})");
     }
     $Group->delete();
     return redirect(route('admin.groups.list'));
 }
開發者ID:DJZT,項目名稱:tezter,代碼行數:12,代碼來源:GroupsController.php

示例3: addGroupUser

 /**
  * 項目添加用戶
  *
  * @param $projectId
  * @param $userId
  * @return bool
  */
 public static function addGroupUser($projectId, $userId)
 {
     // 是否已在組內
     $exists = Group::find()->where(['project_id' => $projectId, 'user_id' => $userId])->count();
     if ($exists) {
         return true;
     }
     $group = new Group();
     $group->attributes = ['project_id' => $projectId, 'user_id' => $userId];
     return $group->save();
 }
開發者ID:uedzen,項目名稱:walle-web,代碼行數:18,代碼來源:Group.php

示例4: up

 /**
  * Run the migrations.
  */
 public function up()
 {
     Schema::create('groups', function ($table) {
         $table->increments('id');
         $table->string('name');
         $table->string('address1');
         $table->string('address2');
         $table->string('city');
         $table->string('state');
         $table->string('postal_code');
         $table->string('phone_number');
         $table->string('display_name');
         $table->enum('status', Group::getStatuses());
         $table->timestamps();
         $table->softDeletes();
     });
     Schema::create('group_members', function ($table) {
         $table->increments('id');
         $table->integer('group_id')->unsigned();
         $table->integer('user_id')->unsigned();
         $table->enum('role', Group::getRoles());
         $table->timestamps();
         $table->softDeletes();
         $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
         $table->foreign('group_id')->references('id')->on('groups')->onDelete('cascade');
     });
 }
開發者ID:DCgov,項目名稱:dc-madison,代碼行數:30,代碼來源:2014_04_22_202758_add_group_tables.php

示例5: all

 public function all($params)
 {
     $params['order'] = isset($params['order']) ? $params['order'] : ['display_name|ASC'];
     $groups = Group::select("groups.*");
     $groups = parent::execute($groups, $params);
     return $groups;
 }
開發者ID:pinkynrg,項目名稱:convergence2.0,代碼行數:7,代碼來源:GroupsController.php

示例6: actionSubcat

 public function actionSubcat()
 {
     $out = [];
     $isEmpty = true;
     if (isset($_POST['depdrop_parents'])) {
         $parents = $_POST['depdrop_parents'];
         if ($parents != null) {
             $cat_id = $parents[0];
             $out = Group::getDropDownList($cat_id);
             //$out = [['id'=>'1', 'name'=>$cat_id],['id'=>'2', 'name'=>json_encode(Group::getDropDownList($cat_id))]];
             $isEmpty = false;
             $selected = '';
             if (!empty($_POST['depdrop_params'])) {
                 $params = $_POST['depdrop_params'];
                 $selected = $params[0];
                 // get the value of input-type-1
                 $param2 = $params[1];
                 // get the value of input-type-2
             }
             echo Json::encode(['output' => $out, 'selected' => $selected]);
         }
     }
     if ($isEmpty) {
         echo Json::encode(['output' => [['id' => '1', 'name' => '<sub-cat-name1>'], ['id' => '2', 'name' => '<sub-cat-name2>']], 'selected' => '']);
     }
 }
開發者ID:devpopov,項目名稱:study-online-service-public,代碼行數:26,代碼來源:RegistrationController.php

示例7: delete

 public function delete($id)
 {
     if (Group::destroy($id)) {
         return redirect()->back()->with('msg', 'Группа удалена');
     }
     return redirect()->back()->with('warning', 'Не удалось удалить');
 }
開發者ID:Quiss,項目名稱:Twiga,代碼行數:7,代碼來源:AdminGroupController.php

示例8: 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'));
 }
開發者ID:Quiss,項目名稱:Twiga,代碼行數:7,代碼來源:IndexController.php

示例9: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $data['groups'] = Group::orderBy('groupname')->get();
     $data['setting'] = Setting::find($id);
     $data['themes'] = array('cerulean' => 'cerulean', 'cosmo' => 'cosmo', 'cyborg' => 'cyborg', 'darkly' => 'darkly', 'flatly' => 'flatly', 'journal' => 'journal', 'lumen' => 'lumen', 'paper' => 'paper', 'readable' => 'readable', 'sandstone' => 'sandstone', 'simplex' => 'simplex', 'slate' => 'slate', 'spacelab' => 'spacelab', 'superhero' => 'superhero', 'united' => 'united', 'yeti' => 'yeti');
     return View::make('settings.edit', $data);
 }
開發者ID:bishopm,項目名稱:circuit,代碼行數:13,代碼來源:SettingsController.php

示例10: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit(User $User)
 {
     $this->data['Roles'] = Role::all();
     $this->data['Groups'] = Group::all();
     $this->data['User'] = $User;
     return view('admin.users.edit', $this->data);
 }
開發者ID:DJZT,項目名稱:tezter,代碼行數:13,代碼來源:UsersController.php

示例11: actionSubmit

 /**
  * 提交任務
  *
  * @param $projectId
  * @return string
  */
 public function actionSubmit($projectId = null)
 {
     $task = new Task();
     if ($projectId) {
         $conf = Project::find()->where(['id' => $projectId, 'status' => Project::STATUS_VALID])->one();
     }
     if (\Yii::$app->request->getIsPost()) {
         if (!$conf) {
             throw new \Exception('未知的項目,請確認:)');
         }
         $group = Group::find()->where(['user_id' => $this->uid, 'project_id' => $projectId])->count();
         if (!$group) {
             throw new \Exception('非該項目成員,無權限');
         }
         if ($task->load(\Yii::$app->request->post())) {
             // 是否需要審核
             $status = $conf->audit == Project::AUDIT_YES ? Task::STATUS_SUBMIT : Task::STATUS_PASS;
             $task->user_id = $this->uid;
             $task->project_id = $projectId;
             $task->status = $status;
             if ($task->save()) {
                 $this->redirect('/task/');
             }
         }
     }
     if ($projectId) {
         return $this->render('submit', ['task' => $task, 'conf' => $conf]);
     }
     // 成員所屬項目
     $projects = Project::find()->leftJoin(Group::tableName(), '`group`.project_id=project.id')->where(['project.status' => Project::STATUS_VALID, '`group`.user_id' => $this->uid])->asArray()->all();
     return $this->render('select-project', ['projects' => $projects]);
 }
開發者ID:uedzen,項目名稱:walle-web,代碼行數:38,代碼來源:TaskController.php

示例12: 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);
 }
開發者ID:johnfelipe,項目名稱:madison,代碼行數:33,代碼來源:DocumentsTableSeeder.php

示例13: 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);
 }
開發者ID:st421,項目名稱:madison,代碼行數:25,代碼來源:GroupsApiController.php

示例14: run

 public function run()
 {
     $total = [];
     foreach (Group::find()->all() as $key => $group) {
         $total[$group->name] = GroupClient::find()->where(['groups_id' => $group->id])->count();
     }
     return $this->render('groups/index', ['group' => new Group(), 'total' => $total]);
 }
開發者ID:hoangngk,項目名稱:adminpanel,代碼行數:8,代碼來源:GroupsWidget.php

示例15: findModel

 /**
  * Finds the User model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return User the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Group::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
開發者ID:hoangngk,項目名稱:adminpanel,代碼行數:15,代碼來源:GroupsController.php


注:本文中的app\models\Group類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。