Sunday, August 28, 2016

Playing with PHP Artisan Migration Commands in Laravel 5.3 - Executing Migrations File

In previous post, we have created some migration files so rightnow we can run migration command to add tables to our database. Here's our migrations files :
Then let's run "php artisan migrate" to execute those files....
So... There is only one table created in database but actually we were executing 3 migrations files that we created before. Why is that happened? because 2 files contains no tables... :D only migration_2 files has table and column inside...
Sooo... mmm... let's get back to migration_1 file and put some columns there like this one :
So we added 4 columns, id, myAwesomeColumn, created_at & updated_at from timestamps...So let's run or execute this file again by using "php artisan migrate".. :D
Ooops... We have executed php artisan migrate before, so there is nothing to migrate... So we know that migrate is only work for new migration file. So for the old one, we can use three options, migrate:refresh,reset, and rollback :
We will try all of those commands one by one.. :D
First let's try rollback.....So type php artisan migrate:rollback
Rollback is almost same with reset... It will remove all of our last migration table. So our DB will contain just migration table. Then run "php artisan migrate" again aaand....

So...be carefull when using this rollback command because it will gonna delete all of your data... :D
Next... Let's try migrate:reset...
aaand... waaaw... database is empy again.. :v
So what's the different between rollback and reset...??? mmm... let's find out later.. :)
Then let's see migrate:refresh....
So refresh is using rollback first and then migrate all of the migration file... :)

One thing to note that if have put some data in our database, the refresh will also delete all data in database because it's using rollback... So becarefull with this one too.. :v

So how to add new column without deleting our data...??? This will be covered in the next post...:)
See yaaaa......

Go to the next post....

PHP Artisan UP & Down in Laravel 5.3



Untuk UP :


Saturday, August 27, 2016

Clearing Laravel 5.3 Application Cache

For clearing cache, we can use "php artisan cache:clear"
Eheheh... That's it.. :D

Playing with Migration Commands in Laravel 5.3 - Environment Setup

In this post, we're going to play with all of the available commands in laravel 5.3. I don't fully understand the meaning of each command. So We will be just executing it and then see the result... ehehe... :D
So let's get started....

First thing first........... Create a new laravel project by using composer command :

After finishing this command, we will get a fresh laravel project like this :
Next, let's set up our database. Btw I'm using xampp in windows 7 here. So just open your phpmyadmin and create new database :

Next... Let's connect this DB to our laravel project. So in Laravel, open the .env file and change it's database config...

Oukaaay... Let's try to run our laravel using "php artisan serve"
Then open localhost:8000 {default laravel port}, we will got a default laravel view as shown below :

If we want to run laravel on another port. We can use this command :
php artisan serve --port="your desired port" {make sure the port is not being used by another app}
So... That's all for environment setup... See yaa in the part... :D


Go to part II ... Generating Migration File....

Playing with PHP Artisan Migration Commands in Laravel 5.3 - Generating Migrations

We are ready to play with real php artisan migrate command now... because in previous part we have setup our laravel environment. Mmmm..... Here is the available command for migration in laravel 5.3 :
Documentation about migration can be seen here..
First.... Let's try migrate:install...
php artisan migrate:install
migrate:install will gonna make our migration table in our database. So after executing this, we will see a new table named migration as shown below :
What is the purpose of this migration table ? Well... This table will contain all of our migration file. So when we create a new migration file, this table will automatically update it's content when we execute php artisan migrate. We will gonna an example about this later.. :v
Next, Let's generate a new migration table. Type php artisan make:migration "your_migration_table_name", For example :
php artisan make:migration hisoka_first_migration
hisoka_first_migration is the name of our migration file...
After executing that command, we will see a new migration file inside of our database-migration folder like this :
As we can from above code, the migration file is not having a table name inside of method up(). So we will need to create it manually using laravel Schema. But there is also a way to create table automatically, from laravel documentation we can use flag like --table and --create. So let's see how these two flags work....
php artisan make:migration migration_1 --table=hisoka_table_1
Yaaps... there is our table name. So if we put --table flag, it will automatically generate our table name. Next let's see --create flag.
php artisan make:migration migration_2 --create=hisoka_table_1
From the code above, we can see that --create flag will also automatically create some column {id and timestamps} instead just creating our table name. 

Btw we still another flag that we can use, namely --path. This flag is used to specify the location of our migration file. In order to use this flag, let's create a new folder first in our laravel directory like this :
Then, run this command :
php artisan make:migration migration_3 --path=hisoka_migration_file


And the result is.....

Yaaaps... I think that's all for generating migrations in laravel 5.3.. See yaa in the next part... :)

Wednesday, August 24, 2016

Friday, August 19, 2016

Malware Inside a Video

This afternoon today, I just downloaded a video from internet. This video is about 700 MB. When I wanted to play this video using VLC Media player, it gave me an error message as shown below :
So I switched to another video player, Media Player Classic, but my MPC couldn't play this video too. "Cannot render the file"
I thought that the video file wasn't fully downloaded, but I checked it again and it's full so there was no problem with uncompleted file. Then I checked the readme file downloaded along with the video :
So I needed to use latest DivX {I don't know what the heck is that divx} and tried to use windows media player. Then I opened the video using my WMP aaaaand.....
A minute later, I was told to download a new codec for my wmp,

Well because this wpm is originally from microsoft and my windows is an original windows, I thought there was no problem with that, so I just downloaded the new codec. The file name is "CodecFix.exe" : {Actually I downloded the file twice wkwkkwkw... B-)}
The nightmare came from this file. I don't really know if this file is fake or not, because I got the link from wmp which is actually through microsoft app, but my antivirus told me that it was a malware...but mmmmmm....Who cares...I disabled my antivirus and double clicked the file aaaand.... tadaaaaaaaaaaaaa....... =)) =))
My chrome suddently closed and seemed that my browser cookies were missing, all of them :v,,,, and my laptop memory became flooding and automatically downloaded some unknown files :3...When I opened my chrome, it redirected me to a new search engine, www.youndoo.com with some parameters that we can see from it's url,..{btw... I hope all people in youndo are good people, so please don't steal any private info from another people again or don't do any bad things in this life. We are all responsible for what we did right... :)} Because my cookies or cache or mm... something like that were missing so I needed to sign in again, but I saw that my chrome looked different and yaaaps... my Chrome seemed infected... So I enabled my antivirus again... :D :D :D  =)) ....Aaand my AV seemed confused :v, so I manually went to directory in C:\Users\Hisoka\AppData\Local, there was an infected folder here {Sorry, I forgot to print screen it :v and some app that I have downloaded}, I manually deleted some files, but some of them couldn't be deleted..... :3.....  After that, I thought my chrome was back to normal, but actually it wasn't, because the font was different wkwkwk... {YoU can't deceive Sharingan eyes..:D}... I checked chrome again and I found that not only my chrome but also firefox was infected to. I right clicked the chrome icon and went to the source directory aaand there you are :
Those 3 files were infected/source of youndoo and we need to delete it from our disk. Because even we move it to another directory, those files still run whenever we run chrome or firefox and start opening youndo.com.... mmm...Because the content of those files is same :D wkwkwk....












Sooo..... I restarted my laptop and scanned it's drives while windows was booting......After login again, I still saw an infected files, it's my beautifull app service.exe... :v :v :v

Hufffh.....I just left it like that, And then I created a new shortcut for chrome {It was taken from google directory in program files} and I saw that It's already using "https", so mmm... I tried to login and wrote this note... :D... and ooowh...  http://www.youndoo.com/ is like this :

Good luck Youndoo...
Please become a good search engine... :)

Sooo.... mmmm......mmmmmmmmmmmmmmm...... daaah aaaah.... :D