php - Autofill users informations in the database in Laravel -


When a customer subscribes to our website, we want to create multiple rows in the database in this user-related function. For example, for example some examples, etc., to show how the product is working.

This is almost similar to the database-being () but it should be for users, and not

I handle it in a repository class that constantly manages the creation and modification of the data models. You can add a parameter to your creation function, which will populate the seed data after each input.

  & lt; Php class UsersRepository {/ ** * Create * * @ Ultimate array $ data * @ return user * / create public function (array $ data, $ seed = false) {// $ this- & gt; Valid ($ data); // $ data = $ this- & gt; Clean ($ data); $ User = User :: Create ($ data); If ($ seed) $ user = $ this- & gt; Seed ($ user); $ User return; } / ** * Seed * * @ Ultimate User $ user * @ Return User * / Public Function Seed (Array $ user) {// Modify user to add essential attributes - user_ & gt; base_functions = 'some_base_function'; $ User return; }}    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -