/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create($entity) { $name = $entity; $membershipPeriods = []; $institutionTypes = []; $titles = []; $payModes = []; $titles = Salutation::all(); $modes = PaymentMode::all(); foreach ($modes as $mode) { $payModes[$mode->id] = $mode->name; } if ($entity == 'institution-academic') { $membershipPeriods = MembershipPeriod::getPeriodsByType(1)->get(); $institutionTypes = InstitutionType::getInstitutionTypesById(1)->get(); return view('frontend.register.institution-academic', compact('entity', 'membershipPeriods', 'institutionTypes', 'titles', 'payModes')); } else { if ($entity == 'institution-non-academic') { $membershipPeriods = MembershipPeriod::getPeriodsByType(2)->get(); return view('frontend.register.institution-non-academic', compact('entity', 'membershipPeriods', 'titles', 'payModes')); } else { if ($entity == 'individual-student') { $membershipPeriods = MembershipPeriod::getPeriodsByType(3)->get(); return view('frontend.register.individual-student', compact('entity', 'membershipPeriods', 'titles', 'payModes')); } else { if ($entity == 'individual-professional') { $membershipPeriods = MembershipPeriod::getPeriodsByType(4)->get(); $non_academic = Institution::where('membership_type_id', 2); // taking all the professional institutions return view('frontend.register.individual-professional', compact('entity', 'membershipPeriods', 'titles', 'payModes', 'non_academic')); } } } } }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('payment_modes')->delete(); $data = [['name' => 'cheque'], ['name' => 'demand draft'], ['name' => 'cash']]; foreach ($data as $value) { PaymentMode::create($value); } }
public function remove(Request $request) { $id = $request->input('id'); $paymentMode = PaymentMode::where(array('id' => $id))->first(); if (isset($paymentMode)) { $paymentMode->delete(); return json_encode(array('message' => 'done')); } else { return json_encode(array('message' => 'invalid')); } }
public function info(Request $request) { $id = $request->input('id'); $customer = Customer::where(array('id' => $id))->first(); $categoryCount = Category::where(array('customer_id' => $id, 'status' => 'active'))->count(); $paymentModeCount = PaymentMode::where(array('customer_id' => $id, 'status' => 'active'))->count(); if (isset($customer)) { return json_encode(array('message' => 'found', 'customer' => $customer, 'category_count' => $categoryCount, 'payment_mode_count' => $paymentModeCount)); } else { return json_encode(array('message' => 'empty')); } }