1. Go to this page and download the library: Download trd-rdm/make-unit-command library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
trd-rdm / make-unit-command example snippets
public function register()
{
if($this->app->isLocal()) {
$this->app->register(
\RDM\MakeUnitCommand\UnitCommandServiceProvider::class);
}
}
// TODO: 檢查 User 建立 Routes URI 是否正確
Route::get('user', 'Folder\User\Controller@index');
Route::post('user', 'Folder\User\Controller@store');
Route::put('user/{user}', 'Folder\User\Controller@update');
Route::delete('user/{user}', 'Folder\User\Controller@destroy');
use App\Rules\PositiveKey;
public function authorize(): bool
{
switch ($this->method_name) {
case "index":
return $this->can('search', 'permission');
case "update":
return $this->can(['create', 'update'], 'permission');
case "review":
return $this->can(function($request) {...});
}
}
public function rules(): array
{
switch ($this->method_name) {
case "store":
$rules = [
"name" => '