...
|
Before Width: | Height: | Size: 143 KiB |
|
Before Width: | Height: | Size: 129 KiB |
BIN
MyObsidianVault/Pasted image 20241113085432.png
Normal file
|
After Width: | Height: | Size: 159 KiB |
BIN
MyObsidianVault/Pasted image 20241113085948.png
Normal file
|
After Width: | Height: | Size: 96 KiB |
BIN
MyObsidianVault/Pasted image 20241113090300.png
Normal file
|
After Width: | Height: | Size: 264 KiB |
|
|
@ -23,3 +23,8 @@ Creates Controller, Model, Migration, Seeder
|
||||||
//down:
|
//down:
|
||||||
$this->forge->dropTable("students");
|
$this->forge->dropTable("students");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php spark migrate
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
https://www.youtube.com/watch?v=4_MdtVqfH1o&list=PLT9miexWCpPW6Z_OXNv2d78cqCrZaPrVG&index=9
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php spark make:model Student --suffix
|
||||||
|
```
|
||||||
|
Creates StudentModel.php in app/Models
|
||||||
|
|
||||||
|
|
||||||
|
Add allowedFields
|
||||||
|
![[Pasted image 20241113082554.png]]
|
||||||
|
|
||||||
|
Add Model to Controller
|
||||||
|
![[Pasted image 20241113082703.png]]
|
||||||
|
![[Pasted image 20241113083139.png]]
|
||||||
|
|
||||||
|
|
||||||
|
add to routes
|
||||||
|
```php
|
||||||
|
$routes->get("add-student", "StudentController::insertStudent");
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
update example (condition, data):
|
||||||
|
|
||||||
|
![[Pasted image 20241113083603.png]]
|
||||||
|
|
||||||
|
delete:
|
||||||
|
|
||||||
|
![[Pasted image 20241113083823.png]]
|
||||||
|
get all :
|
||||||
|
![[Pasted image 20241113084056.png]]
|
||||||
|
|
||||||
|
get single with generic condition:
|
||||||
|
|
||||||
|
![[Pasted image 20241113084645.png]]
|
||||||
|
|
||||||
23
MyObsidianVault/WebDev/2 CodeIgniter/5.) Seeder.md
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
For creating dummy data
|
||||||
|
|
||||||
|
Seeder files go into app/Database/Seeds
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php spark make:seeder Student --suffix
|
||||||
|
```
|
||||||
|
|
||||||
|
fill run method
|
||||||
|
|
||||||
|
![[Pasted image 20241113085432.png]]
|
||||||
|
|
||||||
|
Run seeder file
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php spark db:seed StudentSeeder
|
||||||
|
```
|
||||||
|
|
||||||
|
Mass dummy data using Factory / Faker
|
||||||
|
|
||||||
|
![[Pasted image 20241113085948.png]]
|
||||||
|
|
||||||
|
![[Pasted image 20241113090300.png]]
|
||||||
|
Before Width: | Height: | Size: 155 KiB After Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 249 KiB After Width: | Height: | Size: 249 KiB |
|
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 172 KiB |
|
Before Width: | Height: | Size: 170 KiB After Width: | Height: | Size: 170 KiB |
BIN
MyObsidianVault/_images/Pasted image 20241113082554.png
Normal file
|
After Width: | Height: | Size: 228 KiB |
BIN
MyObsidianVault/_images/Pasted image 20241113082703.png
Normal file
|
After Width: | Height: | Size: 261 KiB |
BIN
MyObsidianVault/_images/Pasted image 20241113083139.png
Normal file
|
After Width: | Height: | Size: 192 KiB |
BIN
MyObsidianVault/_images/Pasted image 20241113083603.png
Normal file
|
After Width: | Height: | Size: 206 KiB |
BIN
MyObsidianVault/_images/Pasted image 20241113083823.png
Normal file
|
After Width: | Height: | Size: 142 KiB |
BIN
MyObsidianVault/_images/Pasted image 20241113084056.png
Normal file
|
After Width: | Height: | Size: 91 KiB |
BIN
MyObsidianVault/_images/Pasted image 20241113084645.png
Normal file
|
After Width: | Height: | Size: 202 KiB |