本文整理汇总了PHP中Club::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Club::find方法的具体用法?PHP Club::find怎么用?PHP Club::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Club
的用法示例。
在下文中一共展示了Club::find方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: vaultUpdate
public function vaultUpdate($id)
{
$user = Auth::user();
$follow = Follower::where("user_id", "=", $user->id)->FirstOrFail();
$club = Club::find($follow->club_id);
$validator = Validator::make(Input::all(), Payment::$rules);
if ($validator->passes()) {
//validation done prior ajax
$param = array('customer_vault_id' => $id, 'club' => $club->id, 'ccnumber' => Input::get('card'), 'ccexp' => sprintf('%02s', Input::get('month')) . Input::get('year'), 'cvv' => Input::get('cvv'), 'address1' => Input::get('address'), 'city' => Input::get('city'), 'state' => Input::get('state'), 'zip' => Input::get('zip'));
$payment = new Payment();
$transaction = $payment->update_customer($param, $user);
if ($transaction->response == 3 || $transaction->response == 2) {
$data = array('success' => false, 'error' => $transaction);
return $data;
} else {
//update user customer #
$user->profile->customer_vault = $transaction->customer_vault_id;
$user->profile->save();
//retrived data save from API - See API documentation
$data = array('success' => true, 'customer' => $transaction->customer_vault_id, 'card' => substr($param['ccnumber'], -4), 'ccexp' => $param['ccexp'], 'zip' => $param['zip']);
return Redirect::action('AccountController@settings')->with('notice', 'Payment information updated successfully');
}
}
return Redirect::back()->withErrors($validator)->withInput();
return Redirect::action('AccountController@settings');
}
示例2: create
/**
* Show the form for creating a new resource.
* GET /player/create
*
* @return Response
*/
public function create()
{
$user = Auth::user();
$follow = Follower::where("user_id", "=", $user->id)->FirstOrFail();
$club = Club::find($follow->club_id);
$title = 'League Together - Player';
return View::make('app.account.player.create')->with('page_title', $title)->with('club', $club)->withUser($user);
}
示例3: store
/**
* Store a newly created resource in storage.
* POST /administratorclub
*
* @return Response
*/
public function store()
{
$uuid = Uuid::generate();
$validator = Validator::make(Input::all(), AdministratorClub::$rules);
if ($validator->passes()) {
$repo = App::make('UserRepository');
$user = $repo->signup(Input::all());
$role = Role::find(2);
$user->attachRole($role);
if ($user->id) {
$profile = new Profile();
$profile->user_id = $user->id;
$profile->firstname = Input::get('firstname');
$profile->lastname = Input::get('lastname');
$profile->mobile = Input::get('mobile');
$profile->avatar = '/img/coach-avatar.jpg';
$profile->save();
$club = new Club();
$club->id = $uuid;
$club->name = Input::get('name');
$club->sport = 'lacrosse';
$club->phone = Input::get('contactphone');
$club->website = Input::get('website');
$club->email = Input::get('contactemail');
$club->add1 = Input::get('add1');
$club->city = Input::get('city');
$club->state = Input::get('state');
$club->zip = Input::get('zip');
$club->logo = Input::get('logo');
$club->waiver = Input::get('waiver');
$club->processor_user = Crypt::encrypt(Input::get('processor_user'));
$club->processor_pass = Crypt::encrypt(Input::get('processor_pass'));
$club->save();
$clubs = Club::find($uuid);
$clubs->users()->save($user);
if (Config::get('confide::signup_email')) {
Mail::queueOn(Config::get('confide::email_queue'), Config::get('confide::email_account_confirmation'), compact('user'), function ($message) use($user) {
$message->to($user->email, $user->username)->subject(Lang::get('confide::confide.email.account_confirmation.subject'));
});
}
return Redirect::action('UsersController@login')->with('notice', Lang::get('confide::confide.alerts.account_created'));
} else {
$error = $user->errors()->all(':message');
return Redirect::back()->withInput(Input::except('password'))->withErrors($error);
}
}
return Redirect::back()->withErrors($validator)->withInput();
}
示例4: create
/**
* Show the form for creating a new resource.
* GET /calendar/create
*
* @return Response
*/
public function create($id)
{
$event = Evento::find($id);
$club = Club::find($event->club_id);
return View::make('icalendar.create')->with('event', $event)->with('club', $club);
}
示例5: doPaymentSelect
public function doPaymentSelect($id)
{
$user = Auth::user();
$member = Member::find($id);
$title = 'League Together - ' . $member->team->club->name . ' Teams';
$type = Input::get('type');
$club = Club::find($member->team->club->id);
switch ($type) {
case 'full':
$price = $member->getOriginal('due');
$today = Carbon::Now();
$early = new Carbon($member->early_due_deadline);
if ($member->early_due_deadline) {
if ($today->startOfDay() <= $early->startOfDay()) {
$price = $member->getOriginal('early_due');
}
}
$item = array('id' => $member->team->id, 'name' => "Membership Team " . $member->team->name, 'price' => $price, 'quantity' => 1, 'organization' => $member->team->club->name, 'organization_id' => $member->team->club->id, 'member_id' => $member->id, 'player_id' => $member->player->id, 'user_id' => $user->id, 'type' => $type, 'autopay' => false);
Cart::insert($item);
foreach (Cart::contents() as $item) {
$item->name = "Membership Team " . $member->team->name;
$item->quantity = 1;
}
return Redirect::action('MemberController@paymentCreate', array($member->id));
case 'plan':
$price = $member->plan->getOriginal('initial');
$item = array('id' => $member->team->id, 'name' => "Membership Team " . $member->team->name, 'price' => $price, 'quantity' => 1, 'organization' => $member->team->club->name, 'organization_id' => $member->team->club->id, 'member_id' => $member->id, 'player_id' => $member->player->id, 'user_id' => $user->id, 'type' => $type, 'autopay' => false);
Cart::insert($item);
foreach (Cart::contents() as $item) {
$item->name = "Membership Team " . $member->team->name;
$item->quantity = 1;
}
return Redirect::action('MemberController@paymentCreate', array($member->id));
default:
return Redirect::action('MemberController@paymentSelect', array($member->id))->with('error', 'Opps we are having some trouble processing your request, please try later. Error# 345');
}
}
示例6: testClubHasUsers
public function testClubHasUsers()
{
$club = Club::find(1);
$this->assertEquals(10, $club->users->length);
}
示例7: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$startDate = Carbon::now();
$from = Carbon::now()->hour(0)->minute(0)->second(0);
$to = Carbon::now()->hour(23)->minute(59)->second(59);
$schedules = SchedulePayment::where('status', 0)->whereBetween('date', array($from, $to))->with('member.user.profile')->get();
//$schedules = SchedulePayment::where('status', 0)->with('member.user.profile')->get();
$errors = array();
$totalAmount = array();
$errorAmount = array();
//save daylog
$dayLog = new ScheduleDailyLog();
$dayLog->started_on = Carbon::now()->toDateTimeString();
$dayLog->payments_count = count($schedules);
$dayLog->save();
Cart::destroy();
foreach ($schedules as $schedule) {
try {
$vault = $schedule->member->user->profile->customer_vault;
$user = User::find($schedule->member->user->id);
$player = Player::find($schedule->member->player->id);
$club = Club::find($schedule->club_id);
$team = Team::find($schedule->member->team_id);
$uuid = Uuid::generate();
$member = Member::find($schedule->member->id);
$history = SchedulePayment::find($schedule->id);
//manually login user out before login new user
Auth::logout();
//manually login user
Auth::login($user);
//clear cart content
Cart::destroy();
//set cart item
$itemCart = array('id' => $team->id, 'name' => "Scheduled payment for " . $team->name, 'price' => $schedule->subtotal, 'quantity' => 1, 'organization' => $club->name, 'organization_id' => $club->id, 'player_id' => $player->id, 'user_id' => $user->id, 'type' => 'full', 'autopay' => true);
Cart::insert($itemCart);
//check if vault exist
if ($vault) {
$param = array('customer_vault_id' => $vault, 'discount' => null, 'club' => $club->id);
$payment = new Payment();
$transaction = $payment->sale($param);
//temp json_decode(json_encode($array), FALSE);
//$transaction = json_decode(json_encode(array('response' => 1, 'total'=>$schedule->total, 'fee'=>$schedule->fee)), FALSE);
if ($transaction->response == 3 || $transaction->response == 2) {
$errors[] = array('payment_schedule_id' => $schedule->id, 'error_description' => $transaction->transactionid . ' : ' . $transaction->responsetext, 'error_amount' => $schedule->total, 'daily_log_id' => $dayLog->id);
array_push($errorAmount, number_format($schedule->total, 2));
//Email error
$emailerrorstatus = $payment->error($transaction, $club->id, $player->id);
} else {
array_push($totalAmount, number_format($transaction->total, 2));
$payment->id = $uuid;
$payment->customer = $vault;
$payment->transaction = $transaction->transactionid;
$payment->subtotal = $transaction->subtotal;
$payment->service_fee = $transaction->fee;
$payment->total = $transaction->total;
$payment->promo = $transaction->promo;
$payment->tax = $transaction->tax;
$payment->discount = $transaction->discount;
$payment->club_id = $club->id;
$payment->user_id = $user->id;
$payment->player_id = $player->id;
$payment->event_type = null;
$payment->type = $transaction->type;
$payment->save();
//Email receipt
$payment->receipt($transaction, $club->id, $player->id);
$sale = new Item();
$sale->description = $itemCart['name'];
$sale->quantity = $itemCart['quantity'];
$sale->price = $itemCart['price'];
$sale->fee = $transaction->fee;
$sale->member_id = $member->id;
$sale->team_id = $team->id;
$sale->payment_id = $uuid;
$sale->save();
//update schedule
$history->status = 2;
$history->save();
}
} else {
//save error that vault didnt exist
$errors[] = array('payment_schedule_id' => $schedule->id, 'error_description' => 'Customer Vault not found', 'error_amount' => number_format($schedule->total, 2), 'daily_log_id' => $dayLog->id);
array_push($errorAmount, number_format($schedule->total, 2));
}
} catch (Exception $e) {
//save internal error
$errors[] = array('payment_schedule_id' => $schedule->id, 'error_description' => $e, 'error_amount' => number_format($schedule->total, 2), 'daily_log_id' => $dayLog->id);
array_push($errorAmount, number_format($schedule->total, 2));
}
}
//end of foreach schedule
//save log for everything done
$dayLogEnd = ScheduleDailyLog::find($dayLog->id);
$dayLogEnd->ended_on = Carbon::now()->toDateTimeString();
$dayLogEnd->successful_count = Count($totalAmount);
//.........这里部分代码省略.........
示例8: link_users_to_clubs
function link_users_to_clubs()
{
foreach (User::find('all') as $user) {
foreach (Club::find('all') as $club) {
ClubUser::create(array('user_id' => $user->id, 'club_id' => $club->id));
}
}
}
示例9: edit
/**
* Show the form for editing the specified resource.
* GET /contact/{id}/edit
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$user = Auth::user();
$follow = Follower::where("user_id", "=", $user->id)->FirstOrFail();
$club = Club::find($follow->club_id);
$players = $user->players;
$contact = Contact::find($id);
$title = 'League Together - Player';
return View::make('app.account.contact.edit')->with('page_title', $title)->with('players', $players->lists('firstname', 'id'))->with('club', $club)->with('contact', $contact)->withUser($user);
}
示例10: PaymentRemoveCartItemTeam
public function PaymentRemoveCartItemTeam($club, $id)
{
$club = Club::find($club);
$team = Team::find($id);
Cart::destroy();
return Redirect::action('ClubPublicController@paymentSelectTeam', array($club->id, $team->id));
}
示例11: update
/**
* Update the specified resource in storage.
* PUT /club/{id}
*
* @param int $id
* @return Response
*/
public function update($id)
{
$user = Auth::user();
$validator = Validator::make(Input::all(), Club::$rules_update);
if ($validator->passes()) {
$club = Club::find($id);
$club->name = Input::get('name');
$club->phone = Input::get('contactphone');
$club->website = Input::get('website');
$club->email = Input::get('contactemail');
$club->add1 = Input::get('add1');
$club->city = Input::get('city');
$club->state = Input::get('state');
$club->zip = Input::get('zip');
$club->logo = Input::get('logo');
$club->waiver = Input::get('waiver');
$club->save();
$status = $club->save();
if ($status) {
return Redirect::back()->with('notice', 'Club updated successfully');
}
}
$error = $validator->errors()->all(':message');
return Redirect::back()->withErrors($validator)->withInput();
}