36 lines
674 B
Markdown
36 lines
674 B
Markdown
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]]
|
|
|