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


PHP Team::find方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  * POST /group
  *
  * @return Response
  */
 public function store($id)
 {
     //create sub team
     //return Redirect::action('SubController@create',$id)->with( 'notice', 'This action cannot be perform at this moment, please comeback soon.');
     $user = Auth::user();
     $club = $user->clubs()->FirstOrFail();
     $parent_team = Team::find($id);
     $uuid = Uuid::generate();
     $validator = Validator::make(Input::all(), Team::$rules_group);
     if ($validator->passes()) {
         $team = new Team();
         $team->id = $uuid;
         $team->name = Input::get('name');
         $team->season_id = $parent_team->season_id;
         $team->program_id = $parent_team->program_id;
         $team->description = $parent_team->description;
         $team->early_due = $parent_team->getOriginal('early_due');
         $team->early_due_deadline = $parent_team->early_due_deadline;
         $team->due = $parent_team->getOriginal('due');
         $team->plan_id = $parent_team->plan_id;
         $team->open = $parent_team->open;
         $team->close = $parent_team->close;
         $team->max = Input::get('max');
         $team->status = $parent_team->getOriginal('status');
         $team->parent_id = $parent_team->id;
         $team->club_id = $club->id;
         $team->allow_plan = 1;
         $status = $team->save();
         if ($status) {
             return Redirect::action('TeamController@show', $parent_team->id)->with('messages', 'Group created successfully');
         }
     }
     $error = $validator->errors()->all(':message');
     return Redirect::action('SubController@create', $id)->withErrors($validator)->withInput();
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:41,代码来源:SubController.php

示例2: join

 public static function join($id)
 {
     $player = self::get_user_logged_in();
     $Team = Team::find($id);
     $m = new Teammember(array('player_id' => $player->id, 'team_id' => $Team->id));
     $m->save();
     Redirect::to('/team', array('message' => 'Sinut on lisätty joukkueseen'));
 }
开发者ID:Jonharju,项目名称:Tsoha-Bootstrap,代码行数:8,代码来源:team_controller.php

示例3: show

 public static function show($id)
 {
     self::check_logged_in();
     $user = self::get_user_logged_in();
     $event = Event::find($id);
     $team = Team::find($event->team_id);
     $member = Teammember::findByBoth($user->id, $team->id);
     View::make('Event/show.html', array('event' => $event, 'team' => $team, 'member' => $member));
 }
开发者ID:Jonharju,项目名称:Tsoha-Bootstrap,代码行数:9,代码来源:event_controller.php

示例4: getTeams

 public function getTeams($id = NULL)
 {
     if ($id) {
         $team = Team::find($id);
         return View::make('home.team_individual')->with('team', $team);
     } else {
         $teams = Team::all_active()->get();
         return View::make('home.teams')->with('teams', $teams);
     }
 }
开发者ID:robinchow,项目名称:rms,代码行数:10,代码来源:HomeController.php

示例5: findByPlayer

 public static function findByPlayer($player_id)
 {
     $query = DB::connection()->prepare('SELECT team_id FROM Teammember WHERE player_id = :player_id');
     $query->execute(array('player_id' => $player_id));
     $rows = $query->fetchAll();
     $Team = array();
     foreach ($rows as $row) {
         $Team[] = Team::find($row['team_id']);
     }
     return $Team;
 }
开发者ID:Jonharju,项目名称:Tsoha-Bootstrap,代码行数:11,代码来源:teammember.php

示例6: makeMatches

    public function makeMatches() {

        $teams = Team::find('1=1');
        $teamIdByName = Model::pluck($teams, 'teamid', 'name');

        $week = 0;
        $matches = [];

        foreach (explode("\n", file_get_contents("matches.txt")) as $line) {
            $parts = explode("VS", $line);
            if (count($parts) == 1 && substr(trim($line), 0, 2) == '--') {
                $week++;
            }
            if (count($parts) != 2) continue;

            list($name1, $name2) = $parts;
            $name1 = trim($name1);
            $name2 = trim($name2);

            $match = Match::create();
            $match->team1id = $teamIdByName[$name1];
            $match->team2id = $teamIdByName[$name2];
            $match->week = $week;
            $matches[] = $match;

            if (!$match->team1id) {
                die("Equipo desconocido: $name1");
            }
            if (!$match->team2id) {
                die("Equipo desconocido: $name2");
            }

        }

        if (count($matches) >= 1 && count($matches) != count(Match::find('1=1'))) {
            Match::truncate(true);
            Model::saveAll($matches);
            ?>Enfrentamientos actualizados.<br><?
        }
        else {
            ?>No hay cambios en los enfrentamientos.<br><?
        }

    }
开发者ID:xJakub,项目名称:LCE,代码行数:44,代码来源:Batch.php

示例7: isLogin

 /**
  * ログインしているかどうか
  */
 function isLogin()
 {
     if ($this->session->getIsStarted() && $this->session->itemAt('is_login') == 1) {
         // セッション情報取得
         $s_team = $this->session->itemAt('team');
         // ユーザモデル読み込み
         include_once APP_MODELS_PATH . 'team.php';
         // セッション情報からユーザ情報取得
         $obj = new Team();
         $obj->table_name = 'team';
         $team = $obj->find(array(':id' => $s_team['id']), 'WHERE id = :id');
         // セッション情報破棄
         $this->session->remove('team');
         // セッション再登録
         $this->session->add('team', $team[0]);
         return true;
     }
     return false;
 }
开发者ID:nikitiki,项目名称:matching-system,代码行数:22,代码来源:app_controller.php

示例8: create

 /**
  * Show the form for creating a new resource.
  * GET /coach/create
  *
  * @return Response
  */
 public function create($id)
 {
     $user = Auth::user();
     $club = $user->clubs()->FirstOrFail();
     $followers = $club->followers;
     $usersData = [];
     //get player from follower
     foreach ($followers as $follower) {
         $fuser = User::find($follower->user_id);
         if ($fuser) {
             $data['fullname'] = $fuser->profile->firstname . " " . $fuser->profile->lastname;
             $data['user'] = $fuser;
             $usersData[] = $data;
         }
     }
     //return $usersData;
     $title = 'League Together - ' . $club->name . ' Teams';
     $team = Team::find($id);
     $plan = $club->plans()->lists('name', 'id');
     return View::make('app.club.coach.create')->with('page_title', $title)->with('team', $team)->with('club', $club)->with('followers', $followers)->with('plan', $plan)->with('usersData', json_encode($usersData))->withUser($user);
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:27,代码来源:CoachController.php

示例9: team

 public function team($id)
 {
     //add security to avoid stealing of information
     $user = Auth::user();
     Excel::create('roster', function ($excel) use($id) {
         $excel->sheet('Sheetname', function ($sheet) use($id) {
             $event = Team::find($id);
             $team = array();
             if ($event->children->count() > 0) {
                 foreach ($event->children as $e) {
                     foreach ($e->members as $member) {
                         $team[] = $member;
                     }
                 }
             } else {
                 $team = Member::where('team_id', '=', $id)->with('team')->get();
             }
             $sheet->setOrientation('landscape');
             $sheet->loadView('export.lacrosse.roster', ['members' => $team]);
         });
     })->download('xlsx');
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:22,代码来源:ExportController.php

示例10: postView

 public function postView()
 {
     $rules = array('id' => 'required|exists:teams,id', 'name' => 'required|max:255|unique:teams,name,' . Input::get('id'), 'tag' => 'required|max:255', 'upload-logo' => 'max:2500');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::action('Admin_TeamsController@getView', array(Input::get('id')))->withInput()->withErrors($validator);
     } else {
         $team = Team::find(Input::get('id'));
         $team->name = Input::get('name');
         $team->tag = Input::get('tag');
         if (Input::hasFile('upload-logo')) {
             $oldlogopath = $this->dir . $team->logo;
             File::delete($oldlogopath);
             $logofile = Input::file('upload-logo');
             $logofileext = $logofile->getClientOriginalExtension();
             $logo_name = "Team_" . Str::limit(md5(Input::get('name')), 10, false) . '-' . Str::limit(md5(time()), 10, false) . "_" . Str::slug(Input::get('name')) . "." . $logofileext;
             $team->logo = $logo_name;
             $logofile->move($this->dir, $logo_name);
         }
         $team->save();
         return Redirect::action('Admin_TeamsController@getIndex');
     }
 }
开发者ID:TsunamiNori,项目名称:Raffles,代码行数:23,代码来源:TeamsController.php

示例11: update

 /**
  * Update the specified resource in storage.
  * PUT /members/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($team, $id)
 {
     $team = Team::find($team);
     $member = Member::find($id);
     //optional field - if Null take the default value from the team
     // if(!Input::get('early_due')){
     // 	$member->early_due = $team->early_due;
     // }else{
     // 	$member->early_due = Input::get('early_due');
     // }
     // if(!Input::get('early_due_deadline')){
     // 	$member->early_due_deadline = $team->early_due_deadline;
     // }else{
     // 	$member->early_due_deadline = Input::get('early_due_deadline');
     // }
     // if(!Input::get('due')){
     // 	$member->due = $team->due;
     // }else{
     // 	$member->due = Input::get('due');
     // }
     // $member->save();
     $member->team_id = Input::get('team_id');
     $member->save();
     // Redirect with success message.
     return Redirect::action('MemberController@edit', array($member->team->id, $member->id))->with('notice', 'Member updated successfully');
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:33,代码来源:MemberController.php

示例12: getCount

 public static function getCount()
 {
     static $count = null;
     if ($count === null) {
         $count = count(Team::find('1=1'));
     }
     return $count;
 }
开发者ID:xJakub,项目名称:LCE,代码行数:8,代码来源:Team.php

示例13: doRefund

 public function doRefund($id)
 {
     $user = Auth::user();
     $club = $user->clubs()->FirstOrFail();
     $uuid = Uuid::generate();
     $payment = Payment::where('club_id', '=', $club->id)->where('transaction', '=', $id)->FirstOrFail();
     $user_parent = User::find($payment->user_id);
     $uuid = Uuid::generate();
     if ($payment->event_type) {
         $participant = Participant::Find($payment->items->first()->participant_id);
         $event = Evento::find($participant->event->id);
     } else {
         $participant = Member::Find($payment->items->first()->member_id);
         $event = Team::find($participant->team->id);
     }
     $player = Player::Find($participant->player->id);
     //$amount = $payment->getOriginal('subtotal');
     $amount = Input::get('amount');
     if ($amount > $payment->getOriginal('subtotal')) {
         return Redirect::action('AccountingController@refund', $payment->transaction)->with('error', "You cannot refund more than " . $payment->getOriginal('subtotal'));
     }
     if ($amount <= 0 || $amount == '') {
         return Redirect::action('AccountingController@refund', $payment->transaction)->with('error', "Amount must be more than 0");
     }
     if ($amount > 0) {
         $param = array('transactionid' => $payment->transaction, 'club' => $club->id, 'amount' => number_format($amount, 2, ".", ""));
         $transaction = $payment->refund($param);
         if ($transaction->response == 3 || $transaction->response == 2) {
             return Response::json($transaction);
             return Redirect::action('AccountingController@transaction', $payment->transaction)->with('error', $transaction->responsetext);
         } else {
             $payment1 = new Payment();
             $payment1->id = $uuid;
             $payment1->customer = $user_parent->profile->customer_vault;
             $payment1->transaction = $transaction->transactionid;
             $payment1->subtotal = -$transaction->total;
             $payment1->total = -$transaction->total;
             $payment1->club_id = $club->id;
             $payment1->user_id = $user_parent->id;
             $payment1->player_id = $player->id;
             $payment1->type = $transaction->type;
             $sale = new Item();
             $sale->description = $event->name . " ({$transaction->type})";
             $sale->quantity = 1;
             $sale->price = -$transaction->total;
             $sale->payment_id = $uuid;
             if ($payment->event_type) {
                 $payment1->event_type = $event->type_id;
             } else {
                 $payment1->event_type = NULL;
             }
             $payment1->save();
             $sale->save();
             $data = array('club' => $club, 'transaction' => $transaction, 'user' => $user, 'contact' => $user_parent);
             //send notification for refund confirmation
             $mail = Mail::send('emails.receipt.refund', $data, function ($message) use($user, $club, $user_parent) {
                 $message->to($user_parent->email)->subject("Refund Confirmation | " . $club->name);
                 foreach ($club->users()->get() as $value) {
                     $message->bcc($value->email, $club->name);
                 }
             });
         }
         //end of transaction result
     }
     //end of amount test
     return Redirect::action('AccountingController@transaction', $payment->transaction);
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:67,代码来源:AccountingController.php

示例14: doDuplicate

 public function doDuplicate($id)
 {
     $team = Team::find($id);
     $uuid = Uuid::generate();
     $copyTeam = $team->replicate();
     $copyTeam->id = $uuid;
     $status = $copyTeam->save();
     if ($status) {
         return Redirect::action('TeamController@index');
     }
     return Redirect::action('TeamController@dupliate', $team->id)->withErrors($status);
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:12,代码来源:TeamController.php

示例15: function

        return Redirect::to('rms/account/login')->with('warning', 'You must login in to access this area of the site');
    }
});
Route::filter('exec', function () {
    if (!Auth::User()->admin && !Auth::User()->is_currently_part_of_exec()) {
        return Redirect::to('rms/account')->with('warning', 'You are not permitted access. Please login as an admin');
    }
});
Route::filter('admin', function () {
    if (!Auth::User()->admin) {
        return Redirect::to('rms/account')->with('warning', 'You are not permitted access. Please login as an admin');
    }
});
Route::filter('view_team', function () {
    $team_id = Request::segment(4);
    $team = Team::find($team_id);
    if (!Auth::User()->admin && !Auth::User()->is_currently_part_of_exec() && $team->privacy == 1 && !Auth::User()->is_part_of_team(Year::current_year()->id, $team_id)) {
        return Redirect::to('rms/account')->with('warning', 'You are not permitted access. Please login as an admin');
    }
});
Route::filter('manage_team', function () {
    $team_id = Request::segment(4);
    if (!Auth::User()->can_manage_team($team_id)) {
        return Redirect::to('rms/account')->with('warning', 'You are not permitted access. Please login as an admin');
    }
});
Route::filter('signed_up_for_camp', function () {
    if (Auth::user()->has_signed_up_for_camp()) {
        return Redirect::to('rms/camp/registrations/edit');
    }
});
开发者ID:robinchow,项目名称:rms,代码行数:31,代码来源:filters.php


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