本文整理汇总了PHP中Group::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::find方法的具体用法?PHP Group::find怎么用?PHP Group::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIndex
public function getIndex()
{
$action = $_GET['action'];
if ($action == "update") {
$to = $_GET['to'];
$id = $_GET['id'];
$groupEntry = Group::find($id);
$groupEntry->name = $to;
$groupEntry->save();
} else {
if ($action == "delete") {
$id = $_GET['id'];
$groupEntry = Group::find($id);
$groupEntry->delete();
} else {
if ($action == "insert") {
$name = $_GET['name'];
$group = new Group();
$group->name = $name;
$group->save();
}
}
}
return View::make('admin');
}
示例2: destroy
public function destroy($id)
{
if (Auth::user()->is_admin) {
$count = 0;
$grupo = Group::find($id);
$users = User::select('group_ids')->get();
foreach ($users as $key => $user) {
$u = $user->group_ids;
$uarray = explode(',', $u);
if (in_array($id, $uarray, true)) {
$count = $count + 1;
}
}
if ($count > 0) {
$field = $count == 1 ? ' ' : 's';
$field2 = $count == 1 ? ' pertenece' : ' pertenecen';
$message = $count . " Usuario" . $field . $field2 . " al grupo " . $grupo->name;
Session::flash('error', $message);
return Redirect::to('grupos/' . $id);
} else {
$grupo->delete();
$message = "Grupo Eliminado con éxito";
Session::flash('message', $message);
return Redirect::to('grupos');
}
}
}
示例3: edit
public static function edit($id)
{
self::check_logged_in();
$group = Group::find($id);
$members = User::all();
$users = User::getMembers($id);
View::make('group/edit.html', array('attributes' => $group, 'members' => $members, 'users' => $users));
}
示例4: edit
/**
* Show the form for editing the specified group.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
if (!Sentry::getUser()) {
return Redirect::route('sessions.create');
}
$group = Group::find($id);
return View::make('groups.edit', compact('group'));
}
示例5: getPermission
/**
* Retourne le champ permission
*
*/
public function getPermission()
{
if (Auth::check()) {
$group = Auth::user()->group;
} else {
$group = Group::find(2);
}
return Permission::whereRaw('forum_id = ? AND group_id = ?', array($this->id, $group->id))->first();
}
示例6: get_show
public function get_show($group_id)
{
$modules = Group::find($group_id)->modules()->order_by('order', 'asc')->get();
$array = array_map(function ($object) {
return $object->to_array();
}, $modules);
$data = array('aaData' => $array);
return Response::json($data);
}
示例7: approve
public function approve()
{
if (Request::ajax()) {
$pending = PendingGroup::find(Input::get('id'));
Group::find($pending->group_id)->push('students_id', $pending->student_id, true);
$pending->delete();
return Response::json(array('code' => "00", 'stats' => MessageController::getStats()));
}
}
示例8: paginate_all
static function paginate_all($limit, $page)
{
$offset = $limit * ($page - 1);
$result = Group::find('all', array('limit' => $limit, 'offset' => $offset, 'order' => 'id DESC'));
if ($result) {
return $result;
} else {
return FALSE;
}
}
示例9: fetch
/**
* Fetch a single group based on the value of a given column.
*
* For non-unique columns, it will return the first entry found. Returns false if no match is found.
* @param value $value The value to find.
* @param string $name The name of the column to match (defaults to id)
* @return Group
*/
public static function fetch($value, $name = "id")
{
if ($name == "id") {
// Fetch by id
return Group::find($value);
} else {
// Fetch by some other column name
return Group::where($name, $value)->first();
}
}
示例10: actByProduct
protected function actByProduct($method, $id)
{
if ($id = static::idFrom($id) and $model = Product::find($id) and $model->group) {
$group = Group::find($model->group);
if ($group and $group = $group->root()) {
$this->layout = '.' . substr(strrchr($method, '_'), 1);
return $this->{$method}($group);
}
}
}
示例11: pageGroupAuthorization
public function pageGroupAuthorization($group_id)
{
// Access-controlled page
if (!$this->_app->user->checkAccess('uri_authorization_settings')) {
$this->_app->notFound();
}
$group = Group::find($group_id);
// Load all auth rules
$rules = GroupAuth::where('group_id', $group_id)->get();
$this->_app->render('config/authorization.twig', ["group" => $group, "rules" => $rules]);
}
示例12: inviteMember
public function inviteMember()
{
$email = Input::get('email');
$newmember = User::where('email', '=', $email)->firstOrFail();
$group = Group::find(Input::get('groupid'));
$gmembers = unserialize($group->members);
array_push($gmembers, $newmember->id);
$group->members = serialize($gmembers);
$group->save();
return Redirect::to('g/' . $group->uid);
}
示例13: view
public function view($id)
{
$group = Group::find($id);
$group->views += 1;
$group->save();
if (Auth::guest()) {
$group->ismember = false;
} else {
$group->ismember = $this->checkmembers($id);
}
return View::make('group.view')->with('group', $group);
}
示例14: __construct
public function __construct()
{
if (!Auth::guest()) {
$user_id = Auth::user()->id;
$modules = Cache::get($user_id . 'modules', function () use($user_id) {
$group_id = Auth::user()->group_id;
$modules = Group::find($group_id)->modules()->order_by('order', 'asc')->get();
Cache::forever($user_id . 'modules', $modules);
return $modules;
});
return View::share('navigation_modules', $modules);
}
}
示例15: showAllAssignmentView
public function showAllAssignmentView()
{
if (!is_null(Input::get('group_code'))) {
Session::put('group_code', Input::get('group_code'));
}
if (Session::has('group_code')) {
$group = Group::find(new MongoId(Session::get('group_code')));
$students = Student::whereIn('_id', $group->students_id)->get();
return View::make('student.show_all_assignment')->with(array('group' => $group, 'assignments' => $this->evaluateAssignments($group->_id), 'students' => $students));
} else {
return Redirect::to(Lang::get('routes.student'));
}
}