本文整理汇总了PHP中Evento::Find方法的典型用法代码示例。如果您正苦于以下问题:PHP Evento::Find方法的具体用法?PHP Evento::Find怎么用?PHP Evento::Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Evento
的用法示例。
在下文中一共展示了Evento::Find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
* POST /participant
*
* @return Response
*/
public function store($id)
{
$user = Auth::user();
$club = $user->Clubs()->FirstOrFail();
$event = Evento::Find($id);
$player = Player::Find(Input::get('player'));
$uuid = Uuid::generate();
$input = Input::all();
$messages = array('player.required' => 'Please select at least one player');
$validator = Validator::make(Input::all(), Participant::$rules, $messages);
$validator->sometimes(array('fee', 'early_fee', 'early_deadline'), 'required', function ($input) {
return $input->fee != '';
});
$validator->sometimes(array('fee', 'early_fee', 'early_deadline'), 'required', function ($input) {
return $input->early_fee != '';
});
$validator->sometimes(array('fee', 'early_fee', 'early_deadline'), 'required', function ($input) {
return $input->early_deadline != '';
});
$validator->sometimes(array('fee', 'early_fee', 'early_deadline'), 'required', function ($input) {
return $input->plan_id != '';
});
if (empty(Input::get('fee'))) {
$fee = $event->getOriginal('fee');
} else {
$fee = Input::get('fee');
}
if (empty(Input::get('early_fee'))) {
$early_fee = $event->getOriginal('early_fee');
} else {
$early_fee = Input::get('early_fee');
}
if (empty(Input::get('early_deadline'))) {
$early_deadline = $event->early_due_deadline;
} else {
$early_deadline = Input::get('early_deadline');
}
if (empty(Input::get('plan_id'))) {
$plan_id = $event->plan_id;
} else {
$plan_id = Input::get('plan_id');
}
if (Input::get('fee') == '0') {
$fee = 0;
$plan_id = null;
}
if (Input::get('fee') > 0) {
$plan_id = Input::get('plan_id');
}
if ($validator->passes()) {
$participant = new Participant();
$participant->id = $uuid;
$participant->firstname = $player->firstname;
$participant->lastname = $player->lastname;
$participant->due = $fee;
$participant->early_due = $early_fee;
$participant->early_due_deadline = $early_deadline;
$participant->plan_id = $plan_id;
$participant->player_id = $player->id;
$participant->event_id = $event->id;
$status = $participant->save();
if ($status) {
$participant = Participant::find($uuid);
//send email notification of acceptance
$data = array('club' => $club, 'player' => $player, 'user' => $user, 'participant' => $participant);
$mail = Mail::send('emails.notification.event.invite', $data, function ($message) use($user, $club, $participant) {
$message->from('C2C@leaguetogether.com', 'C2C Lacrosse')->to($participant->player->user->email, $participant->accepted_by)->subject("You're Invited to join our event | " . $club->name);
});
return Redirect::action('EventoController@show', $event->id)->with('notice', 'Player added successfully');
} else {
$error = $status->errors()->all(':message');
return Redirect::back()->withInput()->withErrors($error);
}
}
$error = $validator->errors()->all(':message');
return Redirect::back()->withInput()->withErrors($error);
}
示例2: PaymentRemoveCartItem
public function PaymentRemoveCartItem($club, $id)
{
$club = Club::Find($club);
$event = Evento::Find($id);
// Clean the cart
Cart::destroy();
return Redirect::action('ClubPublicController@selectPlayer', array($club->id, $event->id));
}