本文整理汇总了PHP中Plan::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Plan::find方法的具体用法?PHP Plan::find怎么用?PHP Plan::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plan
的用法示例。
在下文中一共展示了Plan::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFindComun
function testFindComun()
{
$institId = 2;
$this->Plan->recursive = 0;
$is1 = $this->Plan->find('all', array('conditions' => array('Plan.instit_id' => $institId)));
$cantPlanesQueHayEnFixture = 2;
$this->assertEqual(count($is1), $cantPlanesQueHayEnFixture, "me tenia que haber traido {$cantPlanesQueHayEnFixture} planes");
$this->assertEqual($is1[0]['Instit']['id'], $institId);
}
示例2: get_delete
public function get_delete($id = NULL)
{
$plan = Plan::find($id);
if (empty($plan)) {
return View::make('msg.error')->with('error', 'Plan doesn\'t exist.');
}
$plan->delete();
return Redirect::to('/admin/plan/overview');
}
示例3: VeryPayment
public static function VeryPayment()
{
if ($user = Sentry::getUser()) {
$dt = Carbon::now();
$payment = Payment::where('user_id', $user->id)->first();
$plan = Plan::find($payment->plan_id);
$create = Carbon::parse($payment->created_at);
if ($create->addDays($plan->time) > $dt) {
return true;
} else {
return false;
}
}
}
示例4: postSubscribe
/**
* postSubscribe
* --------------------------------------------------
* @param (integer) ($planID) The requested Plan ID
* @return Subscribes the user to the selected plan.
* --------------------------------------------------
*/
public function postSubscribe($planID)
{
/* Get the Plan */
$plan = Plan::find($planID);
/* Wrong plan */
if ($plan === null) {
return Redirect::route('payment.plans')->with(['error' => 'Something went wrong with your request, please try again.']);
}
/* Get the current subscription of the user */
$subscription = Auth::user()->subscription;
/* Check if the plan has been modified. Redirect if not */
if ($subscription->plan->id == $plan->id) {
return Redirect::route('payment.plans')->with(['success' => 'You have already been subscribed to the requested plan.']);
}
/* Check if the new plan has Braintree plan_id. Redirect to unsubscribe if not */
if ($plan->braintree_plan_id == null) {
return Redirect::route('payment.unsubscribe');
}
/* Check if the old plan has Braintree plan_id. Cancel the subscription if it has */
if ($subscription->braintree_subscription_id != null) {
/* Cancel subscription */
$result = $subscription->cancelSubscription();
/* Check errors */
if ($result['errors'] == TRUE) {
/* Return with errors */
return Redirect::route('payment.subscribe', $planID)->with('error', $result['messages']);
}
}
/* Check for payment_method_nonce in input */
if (!Input::has('payment_method_nonce')) {
return Redirect::route('payment.subscribe', $plan->id)->with('error', "Something went wrong with your request, please try again.");
}
/* Commit subscription */
$result = $subscription->createSubscription(Input::get('payment_method_nonce'), $plan);
/* Check errors */
if ($result['errors'] == FALSE) {
/* Return with success */
return Redirect::route('payment.subscribe', $planID)->with('success', 'Your subscription was successfull.');
} else {
/* Return with errors */
return Redirect::route('payment.subscribe', $planID)->with('error', $result['messages']);
}
}
示例5: verifyPlan
public static function verifyPlan($data)
{
Log::write('PayPal', 'Verifying plan');
$plan = Plan::find($data['option_selection2']);
if (empty($plan)) {
Log::write('PayPal', 'Plan verify: Plan does not exist');
return View::make('msg.error')->with('error', 'Plan does not exist.');
}
if ($plan->price != $data['mc_gross']) {
Log::write('PayPal', 'Plan price does not match PayPal\'s return price');
return View::make('msg.error')->with('error', 'Prices do not match');
}
$user = User::find($data['option_selection1']);
if (empty($user)) {
Log::write('PayPal', 'Plan verify: User does not exist');
return View::make('msg.error')->with('error', 'User does not exist.');
}
$user->planMake($plan->days, $plan->time, $plan->concurrent);
Log::write('PayPal', 'Plan verifying: checks done, plan given');
return true;
}
示例6: postOrdersSave
public function postOrdersSave()
{
$eid = Session::get('eid');
$count = Plan::find($eid);
$data = array('eid' => $eid, 'pid' => Session::get('pid'), 'encounter_provider' => Session::get('displayname'), 'plan' => Input::get('plan'), 'duration' => Input::get('duration'), 'followup' => Input::get('followup'), 'goals' => Input::get('goals'), 'tp' => Input::get('tp'));
if ($count) {
DB::table('plan')->where('eid', '=', $eid)->update($data);
$this->audit('Update');
$this->api_data('update', 'plan', 'eid', $eid);
$result = 'Orders Updated';
} else {
$id = DB::table('plan')->insertGetId($data);
$this->audit('Add');
$this->api_data('add', 'plan', 'eid', $id);
$result = 'Orders Added';
}
echo $result;
}
示例7: addManually
/**
* Post manual additions transacton form
*/
static function addManually($params)
{
extract($params);
$ipn_url = Config::get('project.paypal_ipn_url');
$params = array('first_name' => Input::get('first_name'), 'last_name' => Input::get('last_name'), 'email' => Input::get('email'), 'password' => Input::get('password'), 'product_id' => Input::get('product_id'), 'plan_id' => Input::get('plan_id'), 'pay_id' => Input::get('pay_id'), 'stripe_token' => Input::get('stripe_token'), 'paypal_sub_id' => Input::get('paypal_sub_id'), 'amount' => Input::get('amount'), 'affiliate_id' => Input::get('affiliate_id'));
$members[] = array('email' => $email, 'fname' => $first_name, 'lname' => $last_name);
$data = array();
if ($members) {
foreach ($members as $member) {
// Add or get buyer
if ($buyer = Buyer::getOrCreate($member)) {
// Get Plan
$plan = Plan::find($plan_id);
if ($plan and !$plan->is_oto) {
// Add purchase for the buyer
$purchase = new Purchase();
$purchase->buyer_id = $buyer->id;
$purchase->product_id = $product_id;
$purchase->plan_id = $plan_id;
$purchase->stripe_token = $stripe_token ? $stripe_token : NULL;
$purchase->paypal_sub_id = $paypal_sub_id ? $paypal_sub_id : NULL;
$purchase->pay_method = 2;
$purchase->affiliate_id = $affiliate_id;
// If method is Stripe
if ($pay_id and DKHelpers::GetPayMethod($pay_id) == 'Stripe') {
$purchase->pay_method = 1;
}
$purchase->save();
}
// Push to PayPal IPN of DK
$ipn_data = array('plan_id' => $plan_id, 'product_id' => $product_id, 'email' => $buyer->email, 'first_name' => $buyer->first_name, 'last_name' => $buyer->last_name, 'password' => $password, 'transaction_id' => $pay_id ? $pay_id : 'MNL-' . time(), 'amount' => $amount, 'manual_transaction' => TRUE);
if ($password) {
$ipn_data['dk_new_user'] = TRUE;
} else {
$ipn_data['dk_new_charge'] = TRUE;
$ipn_data['buyer_id'] = $buyer->id;
}
// Add Curl library
require_once app_path() . "/libraries/Curl/Curl.php";
// Post data to IPN
$curl = new Curl();
$curl->simple_post($ipn_url, $ipn_data, array(CURLOPT_BUFFERSIZE => 10));
}
}
}
return TRUE;
}
示例8: getMenuData
protected function getMenuData()
{
$menu_data = array();
$row = Practiceinfo::find(Session::get('practice_id'));
$menu_data['mtm'] = $row->mtm_extension;
$menu_data['id'] = Session::get('pid');
$row1 = Encounters::where('pid', '=', Session::get('pid'))->where('eid', '!=', '')->where('practice_id', '=', Session::get('practice_id'))->orderBy('eid', 'desc')->first();
if ($row1) {
$menu_data['lastvisit'] = date('F jS, Y', strtotime($row1->encounter_DOS));
} else {
$menu_data['lastvisit'] = "No previous visits.";
}
$row2 = Schedule::where('pid', '=', Session::get('pid'))->where('start', '>', time())->first();
if (isset($row2->start)) {
$menu_data['nextvisit'] = '<br>' . date('F jS, Y, g:i A', $row2->start);
} else {
$menu_data['nextvisit'] = 'None.';
}
$row3 = Encounters::where('pid', '=', Session::get('pid'))->where('eid', '!=', '')->where('practice_id', '=', Session::get('practice_id'))->where('encounter_template', '=', 'standardpsych')->where('addendum', '=', 'n')->orderBy('eid', 'desc')->first();
if ($row3) {
$psych_date = strtotime($row3->encounter_DOS);
$new_psych_date = $psych_date + 31556926;
$psych_query = Encounters::where('pid', '=', Session::get('pid'))->where('eid', '!=', '')->where('practice_id', '=', Session::get('practice_id'))->where('addendum', '=', 'n')->where(function ($query_array1) {
$query_array1->where('encounter_template', '=', 'standardpsych')->orWhere('encounter_template', '=', 'standardpsych1');
})->orderBy('eid', 'desc')->get();
$tp_date = '';
if ($psych_query) {
$i = 0;
$psych_comp = '';
$psych_comp1 = '';
$tp_eid = '';
foreach ($psych_query as $psych_row) {
$planInfo = Plan::find($psych_row->eid);
if ($planInfo) {
if ($i == 0) {
$psych_comp = $planInfo->goals;
$psych_comp .= $planInfo->tp;
$tp_eid = $psych_row->eid;
$tp_eid1 = $tp_eid;
} else {
$psych_comp1 = $planInfo->goals;
$psych_comp1 .= $planInfo->tp;
$tp_eid1 = $psych_row->eid;
}
if ($psych_comp1 != $psych_comp && $i != 0) {
$tp = DB::table('encounters')->where('eid', '=', $tp_eid)->first();
$tp_date = '<strong>Most recent TP adjustment:</strong> ' . date('F jS, Y', strtotime($tp->encounter_DOS)) . '<br>';
break;
} else {
$i++;
$tp_eid = $tp_eid1;
}
}
}
}
$menu_data['psych'] = '<strong>Last Annual Psychiatric Eval:</strong> ' . date('F jS, Y', $psych_date) . '<br><strong>Next Annual Psychiatric Eval Due:</strong> ' . date('F jS, Y', $new_psych_date) . '<br>' . $tp_date;
} else {
$menu_data['psych'] = '';
}
$menu_data['supplements'] = $row->supplements_menu_item;
$menu_data['immunizations'] = $row->immunizations_menu_item;
return $menu_data;
}
示例9: destroy
/**
* Remove the specified resource from storage.
* DELETE /plan/{id}
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$plan = Plan::find($id);
$plan->delete();
return Redirect::action('PlanController@index');
}
示例10: delete
public function delete($id)
{
$user = Auth::user();
$club = $user->Clubs()->FirstOrFail();
$schedule = SchedulePayment::where('id', '=', $id)->where('club_id', '=', $club->id)->first();
if (!$schedule) {
return "Unauthorized";
}
$plan = Plan::find($schedule->plan_id);
$title = 'League Together - ' . $club->name . ' Schedule';
return View::make('app.club.plan.schedule.delete')->with('page_title', $title)->with('club', $club)->with('plan', $plan)->with('schedule', $schedule)->withUser($user);
}
示例11: postDeletePlan
/**
* Post Delete a Product Plan
*/
public function postDeletePlan($product_id, $id)
{
$product = Product::find($product_id);
$plan = Plan::find($id);
$plan->delete();
Session::flash('alert_message', '<strong>Done!</strong> You successfully have deleted the plan.');
return Redirect::to("admin/products/plans/{$product->id}");
}
示例12: update
public function update()
{
$id = Input::get('id');
$tabla = Input::get('tabla');
switch ($tabla) {
case '0':
$clave = Input::get('clave');
$appat = Input::get('ap_pat');
$apmat = Input::get('ap_mat');
$nombre = Input::get('nombre');
$segnombre = Input::get('seg_nombre');
$tipo = Input::get('tipo');
$grado = Input::get('grado');
$tutorias = Input::get('tutorias');
$gestion = Input::get('gestion');
$investigacion = Input::get('investigacion');
$dependencias = Input::get('dependencias');
$edit = Professor::find($id);
$edit->clave = $clave;
$edit->ap_pat = $appat;
$edit->ap_mat = $apmat;
$edit->nombre = $nombre;
$edit->seg_nombre = $segnombre;
$edit->tipo = $tipo;
$edit->id_grado = $grado;
$edit->tutorias = $tutorias;
$edit->gestion = $gestion;
$edit->investigacion = $investigacion;
$edit->dependencias = $dependencias;
$edit->save();
return View::make('crud.crudMaestros')->with('professors', Professor::all());
break;
case '1':
$nombre = Input::get('nombre');
$semestre = Input::get('semestre');
$plan = Input::get('idPlan');
$edit = Subject::find($id);
$edit->nombre = $nombre;
$edit->semestre = $semestre;
$edit->id_plan = $plan;
$edit->save();
return View::make('crud.crudMaterias')->with('subjects', Subject::all());
break;
case '2':
$nombre = Input::get('nombre');
$edit = Aula::find($id);
$edit->nombre = $nombre;
$edit->save();
return View::make('crud.crudAulas')->with('aulas', Aula::all());
break;
case '3':
$nombre = Input::get('nombre');
$edit = Plan::find($id);
$edit->nombre = $nombre;
$edit->save();
return View::make('crud.crudPlanes')->with('plans', Plan::all());
break;
default:
//aqui me redirecciona a una pagina vacia solo con un mensaje 404
return View::make('landing');
break;
}
}
示例13: saveToList
function saveToList($id, $contact, $linkedin_contact_id)
{
$item_id = null;
if (Auth::check()) {
$user = User::find(Auth::user()->id);
if ($user->credits > 0) {
$user->credits = $user->credits - 1;
$user->save();
} else {
$subscription = Auth::user()->subscription()->first();
$transactions = Auth::user()->subscription()->first()->transaction()->get();
$plan_id = $subscription->plan_id;
$plan = Plan::find($plan_id);
foreach ($transactions as $transaction) {
if ($transaction->transaction_type == "charge" && $transaction->paid == 1 && $transaction->refunded == 0) {
if ($transaction->credits > 0) {
$transaction->credits = $transaction->credits - 1;
$transaction->save();
break;
}
}
}
}
$list = Lists::where('user_id', '=', $id)->first();
if (is_numeric($list->id)) {
DB::table('list_item')->insert(array('lists_id' => $list->id, 'linkedin_contact_id' => $linkedin_contact_id, 'linkedin' => $contact));
$lists = DB::table('list_item')->where('lists_id', '=', $list->id)->get();
$item_id = $lists[count($lists) - 1]->id;
DashboardController::cacheList($id, 0);
}
}
return $item_id;
}
示例14: postEdit
public function postEdit()
{
$input = Input::all();
$rules = Config::get('validations.service_plan');
$rules['name'][] = 'unique:service_plans,name,' . $input['id'];
$v = Validator::make($input, $rules);
if ($v->fails()) {
return Redirect::back()->withInput()->withErrors($v);
}
if ($input['policy_type'] == 'PolicySchema') {
$input['policy_id'] = $input['schema_id'];
unset($input['schema_id']);
}
try {
DB::transaction(function () use($input) {
$plan = Plan::find($input['id']);
if ($input['plan_type'] == 1) {
$limit = $this->_makeLimit($input);
if (!$plan->limit()->save($limit)) {
throw new Exception("Failed to update Service Plan.");
}
} else {
if ($plan->plan_type == 1) {
if (!$plan->limit()->delete()) {
throw new Exception("Failed to delete limits");
}
}
}
$plan->fill($input);
if (!$plan->save()) {
throw new Exception("Plan updation failed.");
}
});
$this->notifySuccess("Service Plan successfully updated.");
return Redirect::route(self::HOME);
} catch (Exception $e) {
$this->notifyError($e->getMessage());
return Redirect::route(self::HOME);
}
}
示例15: _makeRechargeDetails
private function _makeRechargeDetails()
{
$plan = Plan::find($this->postData['plan_id']);
return ['type' => 'recharge', 'plan_name' => $plan->name, 'plan_id' => $plan->id, 'amount' => $plan->price];
}