/** * 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('membership_periods')->delete(); $data = [['membership_type_id' => 1, 'service_id' => 1, 'years' => 1, 'name' => '01 year'], ['membership_type_id' => 1, 'service_id' => 1, 'years' => 2, 'name' => '02 years'], ['membership_type_id' => 1, 'service_id' => 1, 'years' => 3, 'name' => '03 years'], ['membership_type_id' => 1, 'service_id' => 1, 'years' => 4, 'name' => '04 years'], ['membership_type_id' => 1, 'service_id' => 1, 'years' => 5, 'name' => '05 years'], ['membership_type_id' => 1, 'service_id' => 1, 'years' => 10, 'name' => '10 years'], ['membership_type_id' => 1, 'service_id' => 1, 'years' => 15, 'name' => '15 years'], ['membership_type_id' => 1, 'service_id' => 1, 'years' => 20, 'name' => '20 years'], ['membership_type_id' => 2, 'service_id' => 1, 'years' => 1, 'name' => '01 year'], ['membership_type_id' => 2, 'service_id' => 1, 'years' => 2, 'name' => '02 years'], ['membership_type_id' => 2, 'service_id' => 1, 'years' => 3, 'name' => '03 years'], ['membership_type_id' => 2, 'service_id' => 1, 'years' => 4, 'name' => '04 years'], ['membership_type_id' => 2, 'service_id' => 1, 'years' => 5, 'name' => '05 years'], ['membership_type_id' => 2, 'service_id' => 1, 'years' => 10, 'name' => '10 years'], ['membership_type_id' => 2, 'service_id' => 1, 'years' => 15, 'name' => '15 years'], ['membership_type_id' => 2, 'service_id' => 1, 'years' => 20, 'name' => '20 years'], ['membership_type_id' => 3, 'service_id' => 1, 'years' => 1, 'name' => '01 year'], ['membership_type_id' => 3, 'service_id' => 1, 'years' => 2, 'name' => '02 years'], ['membership_type_id' => 3, 'service_id' => 1, 'years' => 3, 'name' => '03 years'], ['membership_type_id' => 3, 'service_id' => 1, 'years' => 4, 'name' => '04 years'], ['membership_type_id' => 4, 'service_id' => 1, 'years' => 1, 'name' => '01 year'], ['membership_type_id' => 4, 'service_id' => 1, 'years' => 2, 'name' => '02 years'], ['membership_type_id' => 4, 'service_id' => 1, 'years' => 3, 'name' => '03 years'], ['membership_type_id' => 4, 'service_id' => 1, 'years' => 4, 'name' => '04 years'], ['membership_type_id' => 4, 'service_id' => 1, 'years' => 0, 'name' => 'life membership']]; foreach ($data as $value) { MembershipPeriod::create($value); } }