当前位置: 首页>>代码示例>>PHP>>正文


PHP Group::findOrFail方法代码示例

本文整理汇总了PHP中Group::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::findOrFail方法的具体用法?PHP Group::findOrFail怎么用?PHP Group::findOrFail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Group的用法示例。


在下文中一共展示了Group::findOrFail方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateGroup

function updateGroup($id)
{
    $app = Slim\Slim::getInstance();
    $json = decodeJsonOrFail($app->request->getBody());
    $group = Group::findOrFail($id);
    $group->update($json);
    echo $group->toJson();
}
开发者ID:MathiasBrandt,项目名称:spcl-e2014-project,代码行数:8,代码来源:groups.php

示例2: update

 /**
  * Update the specified group in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $group = Group::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Group::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $group->update($data);
     return Redirect::route('groups.index');
 }
开发者ID:arbuuuud,项目名称:gnt-aops,代码行数:16,代码来源:GroupsController.php

示例3: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $user = User::findOrFail($this->argument('username'));
     $group = Group::findOrFail($this->argument('group'));
     $moderator = new GroupModerator();
     $moderator->group()->associate($group);
     $moderator->user()->associate($user);
     $moderator->type = $this->option('admin') ? 'admin' : 'moderator';
     $moderator->save();
     $this->info($user->name . ' is now moderator of ' . $group->urlname);
 }
开发者ID:vegax87,项目名称:Strimoid,代码行数:16,代码来源:AddModerator.php

示例4: sendMessageToGroup

function sendMessageToGroup($id)
{
    $app = Slim\Slim::getInstance();
    $group = Group::findOrFail($id);
    $json = decodeJsonOrFail($app->request->getBody());
    if (!isset($json['from'])) {
        $json['from'] = null;
    }
    if (!isset($json['from_user_id'])) {
        $json['from_user_id'] = null;
    }
    $message = new Message($json);
    $message->group()->associate($group);
    $message->save();
    echo $message->toJson();
}
开发者ID:MathiasBrandt,项目名称:spcl-e2014-project,代码行数:16,代码来源:messages.php

示例5: getGroup

 public function getGroup($group, $limit = 20, $page = 0)
 {
     if (!$this->auth) {
         return $this->error('not authorized', 401);
     }
     if (!$this->user->isDev() or !$this->user->isHax() or !$this->user->isGroup($group)) {
         return $this->error('not authorized', 401);
     }
     try {
         $group = Group::findOrFail($group);
         $limit = $limit > 50 ? 50 : $limit;
         $offset = $page <= 0 ? 0 : $limit * $page;
         $notifications = $group->notifications()->take($limit)->skip($offset);
         return $this->response($notifications->get());
     } catch (ModelNotFoundException $e) {
         return $this->error('group not found', 404);
     }
 }
开发者ID:echojc,项目名称:osu-web,代码行数:18,代码来源:NotificationController.php

示例6: edit

 public function edit($id)
 {
     $groupbyid = Group::findOrFail($id);
     $groupbyid = ['groupbyid' => $groupbyid];
     return View::make('group.edit', $groupbyid)->withTitle("Ubah Group");
 }
开发者ID:inseo201,项目名称:simkinerja,代码行数:6,代码来源:GroupController.php

示例7: destroygroup

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroygroup($id)
 {
     $group = Group::findOrFail($id);
     $group->delete();
     return Redirect::action('GroupController@index')->with('success', Lang::get('groups.delete_success'));
 }
开发者ID:jarciga,项目名称:Euler2015Alpha,代码行数:12,代码来源:GroupController.php

示例8: deleteAction

 public function deleteAction()
 {
     try {
         $form = new GroupForm();
         if ($form->isValidForDelete()) {
             $group = Group::findOrFail(Input::get("id"));
             $group->delete();
         }
         //return Redirect::route("group/index");
     } catch (\Illuminate\Database\QueryException $e) {
         //001 Codigo error
     }
     return Redirect::route("group/index");
 }
开发者ID:alejandromorg,项目名称:Inventario,代码行数:14,代码来源:GroupController.php

示例9: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     try {
         $group = Group::findOrFail($id);
         //prepare the meeting time for user friendly display
         $meetingTime = substr($group->meeting_time, 0, 1) == '0' ? substr($group->meeting_time, 1, 1) : substr($group->meeting_time, 0, 2);
         $group->meeting_time = $meetingTime . ':' . substr($group->meeting_time, -2, 2);
         $nextMeeting = $this->determineNextMeetingDate($group);
         if (Request::wantsJson()) {
             return Response::json(['group' => $group, 'nextMeeting' => $nextMeeting->toFormattedDateString()]);
         } else {
             return View::make('groups.show')->with(['group' => $group, 'nextMeeting' => $nextMeeting->toFormattedDateString()]);
         }
     } catch (Exception $e) {
         Log::error('Failed to find a specific record', array(404, "group: " . $group));
         App::abort(404);
         //this goes directly to the missing method in global.php
     }
 }
开发者ID:ChurchLocal,项目名称:churchlocal.dev,代码行数:25,代码来源:GroupsController.php

示例10: update

 /**
  * Update the specified member in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $member = Member::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Member::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     if (Input::get('branch_id') != null) {
         $branch = Branch::findOrFail(Input::get('branch_id'));
         $member->branch()->associate($branch);
     }
     if (Input::get('group_id') != null) {
         $group = Group::findOrFail(Input::get('group_id'));
         $member->group()->associate($group);
     }
     //$member->photo = Input::get('photo');
     //$member->signature = Input::get('signature');
     if (Input::hasFile('photo')) {
         $destination = public_path() . '/uploads/photos';
         $filename = str_random(12);
         $ext = Input::file('photo')->getClientOriginalExtension();
         $photo = $filename . '.' . $ext;
         Input::file('photo')->move($destination, $photo);
         $member->photo = $photo;
     }
     if (Input::hasFile('signature')) {
         $destination = public_path() . '/uploads/photos';
         $filename = str_random(12);
         $ext = Input::file('signature')->getClientOriginalExtension();
         $photo = $filename . '.' . $ext;
         Input::file('signature')->move($destination, $photo);
         $member->signature = $photo;
     }
     $member->name = Input::get('name');
     $member->id_number = Input::get('id_number');
     $member->membership_no = Input::get('membership_no');
     $member->phone = Input::get('phone');
     $member->email = Input::get('email');
     $member->address = Input::get('address');
     $member->monthly_remittance_amount = Input::get('monthly_remittance_amount');
     $member->gender = Input::get('gender');
     $member->update();
     return Redirect::route('members.index');
 }
开发者ID:kenkode,项目名称:xaraerp,代码行数:50,代码来源:MembersController.php

示例11: show

 /**
  * Display the specified resource.
  *
  * @param  int  $groupId
  * @param  int  $id
  * @return Response
  */
 public function show($groupId, $id)
 {
     $score = Group::findOrFail($groupId)->scores()->findOrFail($id);
     return response()->json($score);
 }
开发者ID:abada,项目名称:pleem,代码行数:12,代码来源:GroupScoreController.php


注:本文中的Group::findOrFail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。