mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-21 16:39:04 +02:00
update cmd line
This commit is contained in:
parent
67a507d530
commit
8c55f6b749
214 changed files with 48553 additions and 48489 deletions
298
snippets/codeigniter4/docs/CHANGE.md
Normal file
298
snippets/codeigniter4/docs/CHANGE.md
Normal file
|
@ -0,0 +1,298 @@
|
|||
## Change Command Snippets
|
||||
|
||||
---
|
||||
|
||||
### Alternate Snippets for View Files
|
||||
|
||||
### `[ProjectRoot]/app/Views/**.php`
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="center" colspan="2">Command</th>
|
||||
<th align="center" rowspan="2">Description</th>
|
||||
<th align="center" rowspan="2">Output</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="center">Lates</th>
|
||||
<th align="center">News</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>ci4_endsection</td>
|
||||
<td nowrap>ci4:views:endSection</td>
|
||||
<td>Make end Section </td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?= $this->endSection() ;?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td>ci4_extend</td>
|
||||
<td nowrap>ci4:views:extend</td>
|
||||
<td>Using Layouts in Views</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?= $this->extend('layouts') ;?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td>ci4_include</td>
|
||||
<td nowrap>ci4:views:include</td>
|
||||
<td>Including View Partials</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?= $this->include('sidebar') ;?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td>ci4_php</td>
|
||||
<td nowrap>ci4:views:php</td>
|
||||
<td>Make php tag</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?php code ;?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td>ci4_php_echo</td>
|
||||
<td nowrap>ci4:views:php-echo</td>
|
||||
<td>Make php echo tag</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?= code ;?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td>ci4_rendersection</td>
|
||||
<td nowrap>ci4:views:renderSection</td>
|
||||
<td>Make render Section</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?= $this->renderSection('content') ;?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td>ci4_section</td>
|
||||
<td nowrap>ci4:views:section</td>
|
||||
<td>Make Section</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?= $this->section('content') ;?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td>ci4_sectionend</td>
|
||||
<td nowrap>ci4:views:section-endSection</td>
|
||||
<td>Make Section with end Section</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?= $this->section('content') ;?>
|
||||
<!-- CODE HERE -->
|
||||
<?= $this->endSection() ;?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
---
|
||||
|
||||
### Alternate Snippets for Routes
|
||||
|
||||
### `[ProjectRoot]/app/Config/Routes.php`
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="center" colspan="2">Command</th>
|
||||
<th align="center" rowspan="2">Description</th>
|
||||
<th align="center" rowspan="2">Output</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="center">Lates</th>
|
||||
<th align="center">News</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>ci4_routes_add</td>
|
||||
<td nowrap>ci4:routes:add</td>
|
||||
<td>Make Routes add() </td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
$routes->add('url', 'ControllerName::index');
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td>ci4_routes_cli</td>
|
||||
<td nowrap>ci4:routes:cli</td>
|
||||
<td>Make Command-Line only Routes</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
$routes->cli('migrate', 'App\Database::migrate');
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td>ci4_routes_env</td>
|
||||
<td nowrap>ci4:routes:env</td>
|
||||
<td>Make Routes Environment</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
$routes->environment('development' , function($routes)
|
||||
{
|
||||
$routes->add('builder','Tools\Builder::index');
|
||||
});
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td>ci4_routes_get</td>
|
||||
<td nowrap>ci4:routes:get</td>
|
||||
<td>Make Routes get()</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
$routes->get('url', 'ControllerName::index');
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td>ci4_routes_group</td>
|
||||
<td nowrap>ci4:routes:group</td>
|
||||
<td>Make Routes group()</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
$routes->group('admin', function($routes)
|
||||
{
|
||||
//Route
|
||||
});
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td>ci4_routes_group_filter</td>
|
||||
<td nowrap>ci4:routes:group-filter</td>
|
||||
<td>Make Routes group() filter</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
$routes->group('api' , ['filter' => 'api-auth'], function($routes)
|
||||
{
|
||||
$routes->resource('url');
|
||||
});
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td>ci4_routes_group_multiple</td>
|
||||
<td nowrap>ci4:routes:group-multiple</td>
|
||||
<td>Make Routes group() multiple</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
$routes->group('admin', function($routes)
|
||||
{
|
||||
$routes->group('users', function($routes)
|
||||
{
|
||||
//Route
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td>ci4_routes_group_namespace</td>
|
||||
<td nowrap>ci4:routes:group-namespace</td>
|
||||
<td>Make Routes group() namespace</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
$routes->group('api' , ['namespace' => 'App\API\v1'], function($routes)
|
||||
{
|
||||
//Route
|
||||
});
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td>ci4_routes_post</td>
|
||||
<td nowrap>ci4:routes:post</td>
|
||||
<td>Make Routes post()</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
$routes->post('url', 'ControllerName::index');
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td>ci4_routes_subdomain</td>
|
||||
<td nowrap>ci4:routes:subdomain</td>
|
||||
<td>Make Routes Limit to Subdomains</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
$routes->add('from', 'to', ['subdomain' => '*']);
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
</tbody>
|
||||
</table>
|
208
snippets/codeigniter4/docs/CONTROLLERS.md
Normal file
208
snippets/codeigniter4/docs/CONTROLLERS.md
Normal file
|
@ -0,0 +1,208 @@
|
|||
### Alternate Snippets for Controllers
|
||||
|
||||
### `[ProjectRoot]/app/Controllers/**.php`
|
||||
|
||||
### Table of Content
|
||||
- [Controllers](#controllers)
|
||||
- [Presenter](#presenter)
|
||||
- [Resources](#resources)
|
||||
- [Request Class](#request-class) <sup style="color:red">New</sup>
|
||||
|
||||
#### Controllers
|
||||
|
||||
<table style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="center">COMMANDS</th>
|
||||
<th align="center">RENDERS</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:controller
|
||||
```
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
public function index()
|
||||
{
|
||||
// code
|
||||
}
|
||||
```
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
##### Presenter
|
||||
|
||||
<table style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="center">COMMANDS</th>
|
||||
<th align="center">RENDERS</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:controller:presenter
|
||||
```
|
||||
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
public function __construct()
|
||||
{
|
||||
// __construct code
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
// index code
|
||||
}
|
||||
|
||||
public function show($id = null)
|
||||
{
|
||||
// show code
|
||||
}
|
||||
|
||||
public function new()
|
||||
{
|
||||
// new code
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
// create code
|
||||
}
|
||||
|
||||
public function edit($id = null)
|
||||
{
|
||||
// edit code
|
||||
}
|
||||
|
||||
public function update($id = null)
|
||||
{
|
||||
// update code
|
||||
}
|
||||
|
||||
public function remove($id = null)
|
||||
{
|
||||
// remove code
|
||||
}
|
||||
|
||||
public function delete($id = null)
|
||||
{
|
||||
// delete code
|
||||
}
|
||||
```
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
##### Resources
|
||||
|
||||
<table style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="center">COMMANDS</th>
|
||||
<th align="center">RENDERS</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:controller:resources
|
||||
```
|
||||
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
public function __construct()
|
||||
{
|
||||
// __construct code
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
// index code
|
||||
}
|
||||
|
||||
public function show($id = null)
|
||||
{
|
||||
// show code
|
||||
}
|
||||
|
||||
public function new()
|
||||
{
|
||||
// new code
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
// create code
|
||||
}
|
||||
|
||||
public function edit($id = null)
|
||||
{
|
||||
// edit code
|
||||
}
|
||||
|
||||
public function update($id = null)
|
||||
{
|
||||
// update code
|
||||
}
|
||||
|
||||
public function delete($id = null)
|
||||
{
|
||||
// delete code
|
||||
}
|
||||
```
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
##### Request Class
|
||||
|
||||
<table style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="center">COMMANDS</th>
|
||||
<th align="center">RENDERS</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:controller:request
|
||||
```
|
||||
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
$this->request->Type('field name');
|
||||
```
|
||||
|
||||
<small>
|
||||
<strong>Type : </strong>getVar, getGet, getPost, getMethod, isAjax, isCLI, isSecure<br>
|
||||
</small>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
245
snippets/codeigniter4/docs/MIGRATIONS.md
Normal file
245
snippets/codeigniter4/docs/MIGRATIONS.md
Normal file
|
@ -0,0 +1,245 @@
|
|||
# Alternate Snippets for Migrations
|
||||
|
||||
## `[ProjectRoot]/app/Database/Migrations/`
|
||||
|
||||
# Table of Content
|
||||
|
||||
- [Create Migration](#create-migration)
|
||||
- [Migration Up](#migration-up)
|
||||
- [Migration Down](#migration-down)
|
||||
- [Create Table](#create-table)
|
||||
- [Add Column](#add-column) [new]
|
||||
- [BIGINT](#bigint) [new]
|
||||
- [CHAR](#char) [new]
|
||||
- [DATETIME](#datetime) [new]
|
||||
- [INT](#int) [new]
|
||||
- [VARCHAR](#varchar) [new]
|
||||
- [ID](#id) [new]
|
||||
- [Timestamp](#timestamp)
|
||||
|
||||
## Create Migration
|
||||
|
||||
**Command**
|
||||
|
||||
```bash
|
||||
ci4:migration
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class AddBlog extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- ### Migration Up
|
||||
|
||||
**Command**
|
||||
|
||||
```bash
|
||||
ci4:migration:up
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
```php
|
||||
public function up()
|
||||
{
|
||||
$this->forge->addField([
|
||||
'id' => [
|
||||
'type' => 'INT',
|
||||
'constraint' => 11,
|
||||
'unsigned' => true,
|
||||
'auto_increment' => true,
|
||||
],
|
||||
'name' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 255,
|
||||
],
|
||||
'created_at' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => true,
|
||||
],
|
||||
'updated_at' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => true,
|
||||
],
|
||||
'deleted_at' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => true,
|
||||
],
|
||||
]);
|
||||
$this->forge->addKey('id', true);
|
||||
$this->forge->createTable('tableName');
|
||||
}
|
||||
```
|
||||
|
||||
- ### Migration Down
|
||||
|
||||
**Command**
|
||||
|
||||
```bash
|
||||
ci4:migration:down
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
```php
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropTable('tableName');
|
||||
}
|
||||
```
|
||||
|
||||
## Create Table
|
||||
|
||||
- ### Add Column
|
||||
|
||||
- #### BIGINT
|
||||
|
||||
**Command**
|
||||
|
||||
```bash
|
||||
ci4:migration:bigint
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
```php
|
||||
'columnName' => [
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => '20',
|
||||
'null' => true,
|
||||
],
|
||||
```
|
||||
|
||||
- #### CHAR
|
||||
|
||||
**Command**
|
||||
|
||||
```bash
|
||||
ci4:migration:char
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
```php
|
||||
'columnName' => [
|
||||
'type' => 'CHAR',
|
||||
'constraint' => '10',
|
||||
'null' => true,
|
||||
],
|
||||
```
|
||||
|
||||
- #### DATETIME
|
||||
|
||||
**Command**
|
||||
|
||||
```bash
|
||||
ci4:migration:datetime
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
```php
|
||||
'columnName' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => true,
|
||||
],
|
||||
```
|
||||
|
||||
- #### INT
|
||||
|
||||
**Command**
|
||||
|
||||
```bash
|
||||
ci4:migration:int
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
```php
|
||||
'columnName' => [
|
||||
'type' => 'INT',
|
||||
'constraint' => '11',
|
||||
'null' => true,
|
||||
],
|
||||
```
|
||||
|
||||
- #### VARCHAR
|
||||
|
||||
**Command**
|
||||
|
||||
```bash
|
||||
ci4:migration:varchar
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
```php
|
||||
'columnName' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '255',
|
||||
'null' => true,
|
||||
],
|
||||
```
|
||||
|
||||
- ### ID
|
||||
|
||||
**Command :**
|
||||
|
||||
```bash
|
||||
ci4:migration:id
|
||||
```
|
||||
|
||||
**Output :**
|
||||
|
||||
```php
|
||||
'id' => [
|
||||
'type' => 'INT',
|
||||
'constraint' => 11,
|
||||
'unsigned' => true,
|
||||
'auto_increment' => true,
|
||||
],
|
||||
```
|
||||
|
||||
- ### Timestamp
|
||||
|
||||
**Command :**
|
||||
|
||||
```bash
|
||||
ci4:migration:timestamp
|
||||
```
|
||||
|
||||
**Output :**
|
||||
|
||||
```php
|
||||
'created_at' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => true,
|
||||
],
|
||||
'updated_at' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => true,
|
||||
],
|
||||
'deleted_at' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => true,
|
||||
],
|
||||
```
|
36
snippets/codeigniter4/docs/MODELS.md
Normal file
36
snippets/codeigniter4/docs/MODELS.md
Normal file
|
@ -0,0 +1,36 @@
|
|||
### Alternate Snippets for Models
|
||||
|
||||
### `[ProjectRoot]/app/Models/*.php`
|
||||
|
||||
### Table of Content
|
||||
|
||||
- [Model Config](#model-config) [new]
|
||||
|
||||
#### Model Config
|
||||
|
||||
- Command
|
||||
```bash
|
||||
ci4:model:config
|
||||
```
|
||||
- Output
|
||||
|
||||
```php
|
||||
protected $table = 'tableName';
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = true;
|
||||
|
||||
protected $allowedFields = ['name'];
|
||||
|
||||
protected $useTimestamps = false;
|
||||
protected $createdField = 'created_at';
|
||||
protected $updatedField = 'updated_at';
|
||||
protected $deletedField = 'deleted_at';
|
||||
|
||||
protected $validationRules = [];
|
||||
protected $validationMessages = [];
|
||||
protected $skipValidation = false;
|
||||
```
|
319
snippets/codeigniter4/docs/ROUTES.md
Normal file
319
snippets/codeigniter4/docs/ROUTES.md
Normal file
|
@ -0,0 +1,319 @@
|
|||
### Alternate Snippets for Routes
|
||||
|
||||
### `[ProjectRoot]/app/Config/Routes.php`
|
||||
|
||||
### Table of Content
|
||||
<!-- - [Alternate Snippets for Routes](#alternate-snippets-for-routes)
|
||||
- [`[ProjectRoot]/app/Config/Routes.php`](#projectrootappconfigroutesphp)
|
||||
- [Table of Content](#table-of-content) -->
|
||||
- [Routes](#routes)
|
||||
- [Placeholders](#placeholders)
|
||||
- [Custom Placeholders](#custom-placeholders)
|
||||
- [Presenter](#presenter)
|
||||
- [Resource](#resource)
|
||||
|
||||
### Routes
|
||||
<table style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="center">COMMANDS</th>
|
||||
<th align="center">RESULTS</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:routes:add
|
||||
```
|
||||
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
$routes->add('url', 'ControllerName::index');
|
||||
```
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:routes:cli
|
||||
```
|
||||
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
$routes->cli('migrate', 'App\Database::migrate');
|
||||
```
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:routes:env
|
||||
```
|
||||
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
$routes->environment('development' , function($routes)
|
||||
{
|
||||
$routes->add('builder','Tools\Builder::index');
|
||||
});
|
||||
```
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:routes:get
|
||||
```
|
||||
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
$routes->get('url', 'ControllerName::index');
|
||||
```
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:routes:group
|
||||
```
|
||||
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
$routes->group('admin', function($routes)
|
||||
{
|
||||
$routes->add('url', 'ControllerName::index');
|
||||
});
|
||||
```
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:routes:group-filter
|
||||
```
|
||||
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
$routes->group('api' , ['filter' => 'api-auth'], function($routes)
|
||||
{
|
||||
$routes->resource('url');
|
||||
});
|
||||
```
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:routes:group-multiple
|
||||
```
|
||||
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
$routes->group('admin', function($routes)
|
||||
{
|
||||
$routes->group('users', function($routes)
|
||||
{
|
||||
//Route
|
||||
});
|
||||
});
|
||||
```
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:routes:group-namespace
|
||||
```
|
||||
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
$routes->group('api' , ['namespace' => 'App\API\v1'], function($routes)
|
||||
{
|
||||
//Route
|
||||
});
|
||||
```
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:routes:post
|
||||
```
|
||||
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
$routes->post('url', 'ControllerName::index');
|
||||
```
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:routes:subdomain
|
||||
```
|
||||
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
$routes->add('from', 'to', ['subdomain' => '*']);
|
||||
```
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
#### Placeholders
|
||||
<table style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="center">COMMANDS</th>
|
||||
<th align="center">RESULTS</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:routes:placeholder
|
||||
```
|
||||
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
$routes->type('url/(:placeholder)', 'ControllerName::index/$1');
|
||||
```
|
||||
<small>
|
||||
<strong>Type : </strong>add, get, post, put, delete<br>
|
||||
<strong>Placeholder : </strong>any, segment, num, alpha, alphanum, hash<br>
|
||||
</small>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
#### Custom Placeholders
|
||||
<table style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="center">COMMANDS</th>
|
||||
<th align="center">RESULTS</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:routes:placeholder:custom
|
||||
```
|
||||
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
$routes->addPlaceholder('uuid', '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}');
|
||||
$routes->type('url/(:uuid)', 'ControllerName::index/$1');
|
||||
```
|
||||
<small>
|
||||
<strong>Type : </strong>add, get, post, put, delete<br>
|
||||
</small>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
#### Presenter
|
||||
<table style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="center">COMMANDS</th>
|
||||
<th align="center">RESULTS</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:routes:presenter
|
||||
```
|
||||
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
$routes->presenter('url');
|
||||
```
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
#### Resource
|
||||
<table style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="center">COMMANDS</th>
|
||||
<th align="center">RESULTS</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td nowrap style="vertical-align: top;">
|
||||
|
||||
```code
|
||||
ci4:routes:resource
|
||||
```
|
||||
|
||||
</td>
|
||||
<td nowrap>
|
||||
|
||||
```php
|
||||
$routes->resource('url');
|
||||
```
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
34
snippets/codeigniter4/docs/VALIDATIONS.md
Normal file
34
snippets/codeigniter4/docs/VALIDATIONS.md
Normal file
|
@ -0,0 +1,34 @@
|
|||
### Alternate Snippets for Validation
|
||||
|
||||
### Table of Content
|
||||
|
||||
- [Alternate Snippets for Validation](#alternate-snippets-for-validation)
|
||||
- [Table of Content](#table-of-content)
|
||||
- [Validation](#validation)
|
||||
- [Validation in Controller](#validation-in-controller)
|
||||
|
||||
### Validation
|
||||
|
||||
#### Validation in Controller
|
||||
|
||||
- Command
|
||||
```code
|
||||
ci4:validation:controller
|
||||
```
|
||||
- Output
|
||||
|
||||
```php
|
||||
$validation = \Config\Services::validation();
|
||||
$rules = [
|
||||
'field_1' => [
|
||||
'label' => 'Field 1 Custom Name',
|
||||
'rules' => 'required',
|
||||
'errors' => [
|
||||
'required' => '{field} is required.'
|
||||
]
|
||||
],
|
||||
];
|
||||
if (!$this->validate($rules)) {
|
||||
return redirect()->to('/route')->withInput()->with('validation', $validation);
|
||||
}
|
||||
```
|
190
snippets/codeigniter4/docs/VIEWS.md
Normal file
190
snippets/codeigniter4/docs/VIEWS.md
Normal file
|
@ -0,0 +1,190 @@
|
|||
### Alternate Snippets for View Files
|
||||
|
||||
### `[ProjectRoot]/app/Views/**.php`
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="center">Command</th>
|
||||
<th align="center">Description</th>
|
||||
<th align="center">Output</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td nowrap>ci4:views:endSection</td>
|
||||
<td>Make end Section in View files</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?= $this->endSection() ;?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap>ci4:views:extend</td>
|
||||
<td>Using Layouts in Views</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?= $this->extend('layouts') ;?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap>ci4:views:foreach</td>
|
||||
<td>Make <code>foreach</code> in View files</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?php foreach ($items as $item) : ?>
|
||||
<li><?= $item ?></li>
|
||||
<?php endforeach ?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap>ci4:views:if</td>
|
||||
<td>Make <code>if</code> in View files</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?php if (condition) : ?>
|
||||
<!-- TRUE -->
|
||||
<?php endif ?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap>ci4:views:if-else</td>
|
||||
<td>Make <code>if else</code> in View files</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?php if (condition) : ?>
|
||||
<!-- TRUE -->
|
||||
<?php else : ?>
|
||||
<!-- FALSE -->
|
||||
<?php endif ?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap>ci4:views:if-elseif</td>
|
||||
<td>Make <code>if elseif</code> in View files</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?php if (condition) : ?>
|
||||
<!-- TRUE -->
|
||||
<?php elseif (condition) : ?>
|
||||
<!-- FALSE -->
|
||||
<?php endif ?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap>ci4:views:if-elseif-else</td>
|
||||
<td>Make <code>if elseif else</code> in View files</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?php if (condition) : ?>
|
||||
<!-- TRUE 1 -->
|
||||
<?php elseif (condition) : ?>
|
||||
<!-- TRUE 2 -->
|
||||
<?php else : ?>
|
||||
<!-- FALSE -->
|
||||
<?php endif ?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap>ci4:views:include</td>
|
||||
<td>Including View Partials</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?= $this->include('sidebar') ;?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap>ci4:views:php</td>
|
||||
<td>Make php tag in View files</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?php code ;?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap>ci4:views:php-echo</td>
|
||||
<td>Make php echo tag in View files</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?= code ;?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap>ci4:views:renderSection</td>
|
||||
<td>Make render Section in View files</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?= $this->renderSection('content') ;?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap>ci4:views:section</td>
|
||||
<td>Make Section in View files</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?= $this->section('content') ;?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td nowrap>ci4:views:section-endSection</td>
|
||||
<td>Make Section with end Section in View files</td>
|
||||
<td>
|
||||
|
||||
```php
|
||||
<?= $this->section('content') ;?>
|
||||
<!-- CODE HERE -->
|
||||
<?= $this->endSection() ;?>
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
Loading…
Add table
Add a link
Reference in a new issue