Wednesday, 26 October 2016

Senarai Pendek Arahan PHP Artisan didalam Laravel 5

Assalamualaikum semua,

Harini saya nak kongsi senarai-senarai arahan pendek yang digunakan oleh PHP Artisan dalam Laravel 5 yang telah diajar oleh cikgu Arham Zulqarnaen pada bulan mei yang lepas.

Berikut adalah arahan php artisan yang biasa digunakan :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// bring down the website - maintenance mode
php artisan down

// bring up the website (out of maintenance mdoe)
php artisan up

// migrate migrations to database
php artisan migrate

// seed database
php artisan db:seed

// seed specific table
php artisan db:seed --class=UserTableSeeder

// create migration (without model)
php artisan make:migration namaMigration
// eg: php artisan make:migration create_kakitangans_table

// create migration and directly point to specific table (handy when adding col)
php artisan make:migration --table=tableName migrationName
// eg: php artisan make:migration --table=users add_role_to_users

// create model and migration for that model
php artisan make:model ModelName
// eg: artisan make:model Kakitangan

// create controller
php artisan make:controller NamaController
// eg: php artisan make:controller KakitanganController

// create plain controller
php artisan make:controller --plain NamaController

// generate encryption key dalam .env
php artisan key:generate

// Revert to previous migration
php artisan migrate:rollback

// Reset the whole migration (full rollback)
php artisan migrate:reset

// reset database and migrate again
php artisan migrate:refresh

// + seed the database after refresh
php artisan migrate:refresh --seed

// checking list of artisan command
php artisan list

// getting help of particular artisan command (php artisan list)
php artisan help someArtisanCommand

// enter tinker mode
php artisan tinker

// change project's default name 
php artisan app:name myProjectName

// create middleware
php artisan make:middleware NamaMiddleware

// create request
php artisan make:request NamaRequest

// with Laracast Laravel-5-Generators-Extended
// https://github.com/laracasts/Laravel-5-Generators-Extended

// to create a complete migration schema from artisan command line
// refer github documentation for proper syntax
make:migration:schema

// to create a pivot table migration between 2 table
// example: tags and posts. A post could have many tags and 
// each tag could be used in many posts as well.
php artisan make:migration:pivot tags posts

// to create a seeder class using artisan command
php artisan make:seed posts

Ok enjoy ya. Sekian dulu.

----------------------------------------------------------
Disediakan Oleh : Zainimar Binti Zulkifli
Sumber : http://arhamzul.com/laravel-5-senarai-pendek-arahan-php-artisan/

0 comments:

Post a Comment