Skip to content

Commit a07f9f6

Browse files
committed
Aula 017 - Introdução ao Spark CLI
1 parent 32f4ee9 commit a07f9f6

18 files changed

+89
-19
lines changed

.gitignore

+14-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,20 @@ user_guide_src/cilexer/build/*
1111
user_guide_src/cilexer/dist/*
1212
user_guide_src/cilexer/pycilexer.egg-info/*
1313

14-
#codeigniter 3
14+
#Temporary Files
15+
*/writable/cache/*
16+
#!*/writable/cache/index.html
17+
*/writable/logs/*
18+
#!*/writable/logs/index.html
19+
*/writable/session/*
20+
!*/writable/session/index.html
21+
*/writable/uploads/*
22+
!*/writable/uploads/index.html
23+
*/writable/debugbar/*
24+
!*/writable/debugbar/.gitkeep
25+
php_errors.log
26+
27+
#CodeIgniter 3
1528
application/logs/*
1629
!application/logs/index.html
1730
!application/logs/.htaccess

TODO.md

+20-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
# TODO
22

3-
### Instalação Composer
3+
### Composer
44

55
> [!NOTE]
66
> CodeIgniter4 requer Composer 2.0.14 ou posterior.
77
8-
Na pasta acima da raiz do seu projeto:
8+
Utilizando o `Composer` para instalar o CodeIgniter4 no seu sistema:
99

1010
```shell
11-
composer create-project codeigniter4/appstarter project-root
11+
composer create-project codeigniter4/appstarter <project_name>
12+
```
13+
14+
Por exemplo, você pode querer instalar a versão 4.3.3 após o lançamento da versão 4.5.5. Nesse caso, especifique a versão no comando:
15+
16+
```shell
17+
composer create-project codeigniter4/appstarter:4.3.3 <project_name>
1218
```
1319

1420
### Spark
@@ -19,8 +25,18 @@ Inicia o servidor de desenvolvimento PHP do CodeIgniter:
1925
php spark serve
2026
```
2127

22-
Gera um novo arquivo de controlador:
28+
Gerar um novo arquivo de `controller` ou `model`:
2329

2430
```shell
2531
php spark make:controller <controller_name>
2632
```
33+
34+
```shell
35+
php spark make:model <model_name>
36+
```
37+
38+
Exibe todas as rotas:
39+
40+
```shell
41+
php spark routes
42+
```

projeto_03/app/Controllers/Teste.php

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace App\Controllers;
4+
5+
use App\Controllers\BaseController;
6+
7+
class Teste extends BaseController
8+
{
9+
public function index()
10+
{
11+
//
12+
}
13+
}

projeto_03/app/Models/Teste.php

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use CodeIgniter\Model;
6+
7+
class Teste extends Model
8+
{
9+
protected $DBGroup = 'default';
10+
protected $table = 'testes';
11+
protected $primaryKey = 'id';
12+
protected $useAutoIncrement = true;
13+
protected $insertID = 0;
14+
protected $returnType = 'array';
15+
protected $useSoftDeletes = false;
16+
protected $protectFields = true;
17+
protected $allowedFields = [];
18+
19+
// Dates
20+
protected $useTimestamps = false;
21+
protected $dateFormat = 'datetime';
22+
protected $createdField = 'created_at';
23+
protected $updatedField = 'updated_at';
24+
protected $deletedField = 'deleted_at';
25+
26+
// Validation
27+
protected $validationRules = [];
28+
protected $validationMessages = [];
29+
protected $skipValidation = false;
30+
protected $cleanValidationRules = true;
31+
32+
// Callbacks
33+
protected $allowCallbacks = true;
34+
protected $beforeInsert = [];
35+
protected $afterInsert = [];
36+
protected $beforeUpdate = [];
37+
protected $afterUpdate = [];
38+
protected $beforeFind = [];
39+
protected $afterFind = [];
40+
protected $beforeDelete = [];
41+
protected $afterDelete = [];
42+
}

projeto_03/writable/debugbar/debugbar_1726967344.655441.json

-1
This file was deleted.

0 commit comments

Comments
 (0)