-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaravel-docs.html
214 lines (156 loc) · 8.97 KB
/
laravel-docs.html
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Laravel</title>
<link rel="stylesheet" href="style.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,[email protected],100..700,0..1,-50..200" />
<style>*{margin:0;padding:0;box-sizing:border-box;font-family:"JetBrains Mono",monospace;font-optical-sizing:auto;font-weight:400;font-style:normal;color:#b5b5bd}body{margin:20px 10px;background:#171923}.box{width:65%;padding:20px;margin:30px auto;background:#111}.box h3{margin-bottom:20px;font-weight:bold;color:#e7e8f2}.box h3::before{content:"# ";color:red;font-weight:bold}.box b{font-weight:bolder;display:block;margin:20px 0 10px 10px}.box b::before{content:"//"}.box p{display:block;margin:20px 0 10px 10px}.box ul,.box ol{margin:20px 10px;list-style-position:inside}.box code{margin:4px;display:flex;color:#bfc7d5;background-color:#292d3e;justify-content:space-between;align-items:center;padding:14px 10px;border-radius:5px}@media only screen and (max-width: 1200px){.box{width:70%}}@media only screen and (max-width: 992px){.box{width:80%}}@media only screen and (max-width: 768px){.box{width:90%}}@media only screen and (max-width: 576px){.box{width:100%}}</style>
</head>
<body>
<div class="box">
<h3>Artisan Console</h3>
<p>Creating a Laravel Project</p>
<code>composer create-project laravel/laravel example-app<br>php artisan serve<br>php artisan serve --host=0.0.0.0 --port=8080</code>
<p>PHP built-in server</p>
<code>php -S 127.0.0.1:8000 -t public</code>
<p>Laravel can display an overview of your application's configuration, drivers, and environment via the about Artisan command.</p>
<code>php artisan about</code>
<p>To quickly generate a new controller, you may run the make:controller Artisan command. By default, all of the controllers for your application are stored in the app/Http/Controllers directory:</p>
<code>php artisan make:controller UserController</code>
<p>Create Symlink: First, you need to link from public folder to storage/app/public folder. For this run the following command in terminal:</p>
<code>php artisan storage:link</code>
<p>This comment should be executed if anything in the .env file is updated.:</p>
<code>php artisan config:cache</code>
<p>generate Laravel new APP_KEY=</p>
<code>php artisan key:generate</code>
<p>Set Bangladesh timezone Asia/Dhaka (GMT+6)</p>
<code>APP_TIMEZONE=Asia/Dhaka</code>
<p>Create Laravel `model, migration, seed, controller` in 1 command.</p>
<code>php artisan make:model ModelName -mcs</code>
</div>
<div class="box">
<h3>Databases & Migrations</h3>
<p>Create a new migration file.</p>
<code>php artisan make:migration create_users_table</code>
<p>Run all pending migrations to apply changes to the database.</p>
<code>php artisan migrate</code>
<p>Rollback the last database migration.</p>
<code>php artisan migrate:rollback</code>
<p>Rollback all database migrations.</p>
<code>php artisan migrate:reset</code>
<p>Rollback and re-run all migrations. This is useful for refreshing your database schema.</p>
<code>php artisan migrate:refresh</code>
<p>Show the status of each migration (whether they have been run or not).</p>
<code>php artisan migrate:status</code>
<p>Drop all tables and re-run all migrations from scratch.</p>
<code>php artisan migrate:fresh</code>
<p>Create the migration repository (the migrations table) if it doesn't exist.</p>
<code>php artisan migrate:install</code>
<p>Rollback a specific number of migrations.</p>
<code>php artisan migrate:rollback --step=<number> <br> php artisan migrate:rollback --step=2</code>
<br><h3>Database Commands</h3>
<p>Run the database seeders to populate your database with test data.</p>
<code>php artisan db:seed</code>
<p>Create a new seeder class.</p>
<code>php artisan make:seeder <br> php artisan make:seeder UserSeeder</code>
<p>Drop all tables, views, and types from the database, but do not run migrations.</p>
<code>php artisan db:wipe</code>
<p>Run the database migrations and seed the database with the data provided in seeders.</p>
<code>php artisan migrate --seed</code>
<p>Display the current database configuration.</p>
<code>php artisan db:show</code>
<p>Dump the current database schema and prune all migrations.</p>
<code>php artisan schema:dump</code>
<p>Monitor your database for connection issues (available in Laravel Vapor or Forge).</p>
<code>php artisan db:monitor</code>
</div>
<div class="box">
<h3>Application Configuration Cache</h3>
<p>Make Cache</p>
<code>
php artisan config:cache <br>
php artisan route:cache <br>
php artisan view:cache <br>
php artisan event:cache <br>
php artisan optimize <br>
</code>
<p>Clear Cache</p>
<code>
php artisan optimize:clear <br>
php artisan route:clear <br>
php artisan config:clear <br>
php artisan view:clear <br>
php artisan event:clear <br>
</code>
<p>Clear the application cache.</p>
<code>php artisan cache:clear</code>
<p>Remove an item from the cache by its key.</p>
<code>php artisan cache:forget {key} <br> php artisan cache:forget user:123</code>
<p>Create a migration for the cache database table.</p>
<code>php artisan cache:table</code>
<p>Create a cache file for faster configuration loading.</p>
<code>php artisan config:cache</code>
<p>Remove the configuration cache file.</p>
<code>php artisan config:clear</code>
<p>Create a route cache file for faster route registration.</p>
<code>php artisan route:cache</code>
<p>Remove the route cache file.</p>
<code>php artisan route:clear</code>
<p>Compile all of the Blade templates into view cache.</p>
<code>php artisan view:cache</code>
<p>Clear all compiled view files.</p>
<code>php artisan view:clear</code>
<p>Clear a specific cache item:</p>
<code>php artisan cache:forget user:123</code>
<p>Optimize performance by caching config and routes:</p>
<code>php artisan config:cache <br> php artisan route:cache</code>
</div>
<div class="box">
<h3>Defining Middleware Commands</h3>
<p>To create a new middleware, use the make:middleware Artisan command:</p>
<code>php artisan make:middleware MinifyViews</code>
<p>Remove an item from the cache by its key.</p>
<code>php artisan cache:forget {key} <br> php artisan cache:forget user:123</code>
<p>Create a migration for the cache database table.</p>
<code>php artisan cache:table</code>
<p>Create a cache file for faster configuration loading.</p>
<code>php artisan config:cache</code>
<p>Remove the configuration cache file.</p>
<code>
php artisan config:clear <br>
php artisan route:clear <br>
php artisan view:clear <br>
</code>
<p>Create a route cache file for faster route registration.</p>
<code>php artisan route:cache</code>
<p>Compile all of the Blade templates into view cache.</p>
<code>php artisan view:cache</code>
<p>Clear a specific cache item:</p>
<code>php artisan cache:forget user:123</code>
<p>Optimize performance by caching config and routes:</p>
<code>php artisan config:cache <br> php artisan route:cache</code>
</div>
<div class="box">
<h3>Common SEO Tools/Packages and Commands in Laravel</h3>
<p></p>
<code>composer require spatie/laravel-sitemap</code>
<p>Generate a sitemap for your website.</p>
<code>php artisan sitemap:generate</code>
<p>Remove TXT file data to clear PowerShell history</p>
<code>C:\Users\atikh\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt</code>
<p></p>
<code></code>
<p></p>
<code></code>
<p></p>
<code></code>
<p></p>
<code></code>
</div>
</body>
</html>