/** * Run the database seeds. * * @return void */ public function run() { $seafoods = ['fish', 'anchovy', 'basa', 'bass', 'cod', 'bream', 'brill', 'eel', 'herring', 'pike', 'pollock', 'salmon', 'sardine', 'shark', 'snapper', 'tilapia', 'trout', 'tuna', 'whiting', 'caviar', 'crab', 'lobster', 'shrimp', 'mollusc', 'conch', 'mussel', 'octopus', 'oyster', 'scallop', 'squid', 'sea']; $seaFoodsArray = array(); //Retrieve all foods with nut in the name. Super rudimentary way to filter, but this will just show that the API works. foreach ($seafoods as $seafood) { $seaFoodsArray = array_merge($seaFoodsArray, \App\Food::GetNameSimilarTo($seafood)->lists('id')->toArray()); } $seaFoodsArray = array_unique($seaFoodsArray); $restriction = App\Restriction::find(2); $restriction->restrictedFoods()->attach($seaFoodsArray); }
/** * Run the database seeds. * * @return void */ public function run() { $nuts = ['acorn', 'cashew', 'pecan', 'nut', 'almond', 'pistachio']; $nutFoodsArray = array(); //Retrieve all foods with nut in the name. Super rudimentary way to filter, but this will just show that the API works. foreach ($nuts as $nut) { $nutFoodsArray = array_merge($nutFoodsArray, \App\Food::GetNameSimilarTo($nut)->lists('id')->toArray()); } $nutFoodsArray = array_unique($nutFoodsArray); $restriction = App\Restriction::find(1); $restriction->restrictedFoods()->attach($nutFoodsArray); }
/** * Run the database seeds. * * @return void */ public function run() { $dairys = ['milk', 'dairy', 'yogurt', 'butter', 'cheese', 'casein', 'clabber', 'gelato', 'cream', 'custard', 'brick', 'brie', 'camembert', 'cheddar', 'chesire', 'colby', 'coldpack', 'edam', 'feta']; $dairysArray = array(); //Retrieve all foods with nut in the name. Super rudimentary way to filter, but this will just show that the API works. foreach ($dairys as $dairy) { $dairysArray = array_merge($dairysArray, \App\Food::GetNameSimilarTo($dairy)->lists('id')->toArray()); } $dairysArray = array_unique($dairysArray); $restriction = App\Restriction::find(3); $restriction->restrictedFoods()->attach($dairysArray); }
/** * Run the database seeds. * * @return void */ public function run() { $chocolates = ['chocolate', 'cocoa']; $chocolatesArray = array(); //Retrieve all foods with nut in the name. Super rudimentary way to filter, but this will just show that the API works. foreach ($chocolates as $chocolate) { $chocolatesArray = array_merge($chocolatesArray, \App\Food::GetNameSimilarTo($chocolate)->lists('id')->toArray()); } $chocolatesArray = array_unique($chocolatesArray); $restriction = App\Restriction::find(5); $restriction->restrictedFoods()->attach($chocolatesArray); }