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

Example of Using Logger in CakePhp

For using simple logger in cakePhp, we simply need to import the log class and call debug as shown below :

Result can be seen inside of 'log' directory as show below:

The above example is from cli or command prompt in windows. But if we put our log in the controller. The result can be seen from the webpage and debug.log as shown below :



Yeeepsss... That's it... :-)