/** * Run the database seeds. * * @return void */ public function run() { $csv = Storage::disk('csv')->get('ethnic_origins.csv'); $array = array_slice(explode("\n", $csv), 1); foreach ($array as $data) { $row = explode(",", $data, 2); $ethnic_origin = new EthnicOrigin(); $ethnic_origin->description = str_replace('"', '', $row[1]); $ethnic_origin->region = $row[0]; $ethnic_origin->save(); } }
/** * Display a listing of the resource. * * @return Response */ public function index() { return EthnicOrigin::all(); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { return EthnicOrigin::where('id', $id)->get(); }
public function run() { $unknown = new EthnicOrigin(); $unknown->description = "No predominant or known ancestry"; $unknown->region = "Unknown"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Kenya, Rwanda, Zimbabwe, South Sudan"; $unknown->region = "Eastern Africa"; $unknown->save(); $unkown = new EthnicOrigin(); $unknown->description = "Angola, Cameroon, Chad, Congo"; $unknown->region = "Middle Africa"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Algeria, Tunisian, Libya, Western Sahara"; $unknown->region = "Northern Africa"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Botswana, Namibia, Swaziland"; $unknown->region = "Southern Africa"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Burkina Faso, Niger, Senegal"; $unknown->region = "Western Africa"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Cuba, Haiti, Trinidad"; $unknown->region = "Caribbean"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Mexico, Panama, Costa Rica"; $unknown->region = "Central America"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Argentina, Brazuk, Venezuela"; $unknown->region = "South America"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Canada, Greenland, United States of America"; $unknown->region = "Northern America"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Kazakhstan, Tajikistan"; $unknown->region = "Central Asia"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "China, Japan, Korea"; $unknown->region = "Eastern Asia"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Afghanistan, India, Sri Lanka, Nepal"; $unknown->region = "Southern Asia"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Philippines, Thailand, Indonesia, Vietnam"; $unknown->region = "South-Eastern Asia"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Turkey, Iraq, Yemen"; $unknown->region = "Western Asia"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Belarus, Poland, Russia"; $unknown->region = "Eastern Europe"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "UK, Iceland, Finland, Norway"; $unknown->region = "Northern Europe"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Italy, Greece, Spain"; $unknown->region = "Southern Europe"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Germany, Netherlands, Belgium, France"; $unknown->region = "Western Europe"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Australia, New Zealand"; $unknown->region = "Australasia"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Fiji, Vanuatu, Solomon Islands"; $unknown->region = "Melanesia"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Guam, Kiribati, Nauru"; $unknown->region = "Micronesia"; $unknown->save(); $unknown = new EthnicOrigin(); $unknown->description = "Cook Islands, Samoa, Tonga"; $unknown->region = "Polynesia"; $unknown->save(); $departments[1] = 'Unknown'; $departments[2] = 'City Administrator'; $departments[3] = 'Community Services'; $departments[4] = 'Corporate Services'; $departments[5] = 'Communications and Economic Development'; $departments[6] = 'Planning and Development'; $departments[7] = 'Public Safety'; $departments[8] = 'Public Works and Engineering'; foreach ($departments as $key => $value) { $department = new Department(); $department->id = $key; $department->active = true; $department->name = $value; $department->save(); } }