/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $users = Member::latest()->paginate(15); $membership_types = MembershipType::lists('type', 'id')->put('0', 'all')->sortBy('id'); $institution_type = InstitutionType::lists('name', 'id'); return view('backend.memberships.listing', compact('membership_types', 'users', 'institution_type', 'typeName')); }
/** * 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('institution_types')->delete(); $data = [['membership_type_id' => 1, 'name' => 'school'], ['membership_type_id' => 1, 'name' => 'college'], ['membership_type_id' => 1, 'name' => 'polytechnic']]; foreach ($data as $value) { InstitutionType::create($value); } }