Wallogit.com
2017 © Pedro Peláez
create controller in laravel --method all
tạo controller từ file controller mẫu, (*1)
Cài đặt, (*2)
composer require hoanghiep/controller "dev-master", (*3)
b2. Chạy lệnh composer, (*4)
composer dump-autoload, (*5)
b3. Đăng ký một dịch vụ mới config/app.php, (*6)
'providers' => [ /***** ****/ Hoanghiep\Controller\HoanghiepControllerProvider::class, ], (*7)
b4. Chạy lệnh xuất bản các tập tin cần thiết, (*8)
php artisan vendor:publish render :, (*9)
file_1 : config/hoanghiep.php => config path class controller old and controller new
file_2 : app/console/Commands/ControllerCommand.php => setting artisan.
file_3 : hoanghiep/controller/template => layout, (*10)
b5. Thiết lập chuẩn bị tập tin controller mẫu :, (*11)
Vào config/hoanghiep.php, (*12)
template_controller_old => file controlller mẫu để sao chép function và method :, (*13)
namespace_old => namespace tìm kiếm trong template_controller_old để thay thế., (*14)
class_controller_old => name class file mẫu template_controller_old để tìm kiếm thay thế, (*15)
namespace_news => nơi file controller sẽ được tạo ra., (*16)
b6. thêm lệnh arrtisan vào App\Console\Kernel.php, (*17)
thêm class Commands\ControllerCommand::class trong protected $commands, (*18)
protected $commands = [
// Commands\Inspire::class,
Commands\ControllerCommand::class
];
b7: Chạy lệnh để tạo ra một file controller mới giống như controller mẫu., (*19)
syntax artisan :, (*20)
php artisan make:controllers name_class, (*21)
Namespace == config/hoanghiep.php => namespace_news, (*22)
1 file controller == namespace_news/name_class, (*23)
END. một file controller mới được tạo ra giống với file controller mẫu., (*24)