For generating model in cakePhp, we use bake command. The command format is "cake bake model yourModelName". Example :
So basically, when baking a model, we'll get 4 files namely model for table, model for entity, test fixture, and testCase table for article.
For baking controller :
And last is for template :
There is another simple way for baking all those tree items. We can use "cake bake all yourTableName", example is shown below :
Thursday, November 1, 2018
Wednesday, October 31, 2018
Seeding Tutorial for Beginner in CakePHP - Windows 10
In the previous post. We've learnt a little bit about migrations in cakephp. Rightnow we'll continue our study to seeder. Simply put, seeder is used to add, modify, or delete a data from our database using a simple program. In cakePhp, if we want to create a seeder, then we just simply type "bin\cake bake seed ourTableName". Example is shown below :
Next, we just have fill the $data variabel above like this :
Next for that seeder we can use this command "cake migrations seed --seed UserSeed" as shown below :
Then the result isss.....
Okiee... That's all... :D
Next, we just have fill the $data variabel above like this :
Next for that seeder we can use this command "cake migrations seed --seed UserSeed" as shown below :
Then the result isss.....
Subscribe to:
Posts (Atom)