oop - Pull mass name list from database or in script? -


i need fill input box first name , last name. user press "randomize" , pull random first , last name , fill inputs.

my question i'm not sure if should put names in tables (firstnames, lastnames) or store them in javascript file , pull straight that.

i'm trying follow single responsibility principle i'm inclined choose former, have 2 more models, 2 more seeders, 2 more tables, , class pull together. , fill csv file or manually populated seeder? seems lot of work , files 1-time use.

i know i'll crap being opinion based question there no 1 or else ask.

also if know of place ask these kind of questions won't me ripped apart i'd appreciate that.

i suggest using faker php library. way wouldn't have create tables, models, or have worry finding fake data.

to install in project, add dependency in composer.json file. , run composer update.

"require-dev": {   "fzaninotto/faker": "1.3.*@dev" }, 

then can use create fake first , last names (in controller likely)

$faker = faker\factory::create();  $firstname = $faker->firstname; $lastname = $faker->lastname; 

edit:

to add own names can either edit or override name provider file located here.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -