Chúng tôi sử dụng cookie để cung cấp cho bạn trải nghiệm duyệt web tốt hơn, phân tích lưu lượng truy cập trang web và cá nhân hóa nội dung. Đọc về cách chúng tôi sử dụng cookie và cách bạn có thể kiểm soát chúng trong Chính sách cookie của chúng tôi. Nếu bạn tiếp tục sử dụng trang web này, bạn đồng ý với việc chúng tôi sử dụng cookie
Trong bài viết này mình sẽ hướng dẫn cách gán giá trị cho thẻ đầu vào trong javascript bằng cách sử dụng thuộc tính
var obj = document.getElementsByTagName['name']; obj[0].value = "value"97
Bài viết này đã được đăng tại freetuts. net , không được sao chép dưới mọi hình thức.
Để gán giá trị cho thẻ đầu vào thì ta có hai cách, thứ nhất là sử dụng thuộc tính
var obj = document.getElementsByTagName['name']; obj[0].value = "value"97, thứ hai là sử dụng phương thức javascript setAttribute. Bài này mình chỉ sử dụng ngôn ngữ javascript thuần thôi nhé, không có sử dụng thư viện jQuery.
1. Use property value gán giá trị cho thẻ đầu vào bằng js
Cách này khá đơn giản, ta sẽ sử dụng cơ chế DOM để truy vấn đến thẻ đầu vào, sau đó gán giá trị cho chúng thông qua thuộc tính giá trị
Truy vấn theo id
document.getElementById['id'].value = "value";
Truy vấn theo tên thẻ
var obj = document.getElementsByTagName['name']; obj[0].value = "value"
Ví dụ. Thiết lập giá trị cho hộp văn bản nhập thẻ khi nhấp vào nút
Bài viết này đã được đăng tại [free tuts. bọc lưới]
Bản trình diễn CHẠY
Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }
2. Use method setAttribute gán giá trị cho thẻ input bằng js
Về cách truy vấn lấy đối tượng html thì mình không viết lại nữa, các bạn xem lại ở phần 1 nhé. Cú pháp như sau
Artisan là giao diện dòng lệnh đi kèm với Laravel. Artisan tồn tại ở thư mục gốc của ứng dụng của bạn dưới dạng tập lệnh
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
3 và cung cấp một số lệnh hữu ích có thể hỗ trợ bạn trong khi xây dựng ứng dụng của mình. Để xem danh sách tất cả các lệnh Artisan có sẵn, bạn có thể sử dụng lệnh namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
4Mỗi lệnh cũng bao gồm một màn hình "trợ giúp" hiển thị và mô tả các đối số và tùy chọn có sẵn của lệnh. Để xem màn hình trợ giúp, hãy đặt trước tên của lệnh bằng
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
5Cánh buồm Laravel
Nếu bạn đang sử dụng Laravel Sail làm môi trường phát triển cục bộ của mình, hãy nhớ sử dụng dòng lệnh
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
6 để gọi các lệnh Artisan. Sail sẽ thực thi các lệnh Artisan của bạn trong bộ chứa Docker của ứng dụng của bạn./vendor/bin/sail artisan list
Tinker [REPL]
Laravel Tinker là một REPL mạnh mẽ cho Laravel framework, được hỗ trợ bởi gói PsySH
Cài đặt
Tất cả các ứng dụng Laravel đều bao gồm Tinker theo mặc định. Tuy nhiên, bạn có thể cài đặt Tinker bằng Composer nếu trước đó bạn đã xóa nó khỏi ứng dụng của mình
________số 8Lưu ý
Bạn đang tìm giao diện người dùng đồ họa để tương tác với ứng dụng Laravel của mình? .
Cách sử dụng
Tinker cho phép bạn tương tác với toàn bộ ứng dụng Laravel của mình trên dòng lệnh, bao gồm các mô hình Eloquent, công việc, sự kiện, v.v. Để vào môi trường Tinker, hãy chạy lệnh
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
7 ArtisanBạn có thể xuất bản tệp cấu hình của Tinker bằng lệnh
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
8var obj = document.getElementsByTagName['name']; obj[0].value = "value"1
Cảnh báo
Hàm trợ giúp9 và phương thức
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
9 trên lớp
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
var obj = document.getElementsByTagName['name']; obj[0].value = "value"41 phụ thuộc vào bộ sưu tập rác để đặt công việc vào hàng đợi. Vì vậy, khi sử dụng tinker, bạn nên sử dụngvar obj = document.getElementsByTagName['name']; obj[0].value = "value"42 hoặcvar obj = document.getElementsByTagName['name']; obj[0].value = "value"43 để điều phối công việc.
Danh sách cho phép lệnh
Tinker sử dụng danh sách "cho phép" để xác định lệnh Artisan nào được phép chạy trong trình bao của nó. Theo mặc định, bạn có thể chạy các lệnh
var obj = document.getElementsByTagName['name']; obj[0].value = "value"44,
var obj = document.getElementsByTagName['name']; obj[0].value = "value"45,
var obj = document.getElementsByTagName['name']; obj[0].value = "value"46,
var obj = document.getElementsByTagName['name']; obj[0].value = "value"47,
var obj = document.getElementsByTagName['name']; obj[0].value = "value"48,
var obj = document.getElementsByTagName['name']; obj[0].value = "value"49 và
Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }30. Nếu bạn muốn cho phép nhiều lệnh hơn, bạn có thể thêm chúng vào mảng
Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }31 trong tệp cấu hình
Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }32 của mình
Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }6
Các lớp không nên đặt bí danh
Thông thường, Tinker tự động đặt bí danh cho các lớp khi bạn tương tác với chúng trong Tinker. Tuy nhiên, bạn có thể muốn không bao giờ bí danh một số lớp. Bạn có thể thực hiện điều này bằng cách liệt kê các lớp trong mảng
Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }33 của tệp cấu hình
Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }32 của bạn
viết lệnh
Ngoài các lệnh được cung cấp bởi Artisan, bạn có thể tạo các lệnh tùy chỉnh của riêng mình. Các lệnh thường được lưu trữ trong thư mục
Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }35;
Tạo lệnh
Để tạo một lệnh mới, bạn có thể sử dụng lệnh Artisan
Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }36. Lệnh này sẽ tạo một lớp lệnh mới trong thư mục
Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }35. Đừng lo lắng nếu thư mục này không tồn tại trong ứng dụng của bạn - nó sẽ được tạo khi bạn chạy lệnh
Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }36 Artisan lần đầu tiên
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
3Cấu trúc lệnh
Sau khi tạo lệnh của bạn, bạn nên xác định các giá trị thích hợp cho các thuộc tính
Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }39 và
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
50 của lớp. Các thuộc tính này sẽ được sử dụng khi hiển thị lệnh của bạn trên màn hình namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
4. Thuộc tính Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }39 cũng cho phép bạn xác định kỳ vọng đầu vào của lệnh. Phương thức
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
53 sẽ được gọi khi lệnh của bạn được thực thi. Bạn có thể đặt logic lệnh của mình trong phương thức nàyHãy xem một lệnh ví dụ. Lưu ý rằng chúng tôi có thể yêu cầu bất kỳ phụ thuộc nào chúng tôi cần thông qua phương thức
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
53 của lệnh. Bộ chứa dịch vụ Laravel sẽ tự động thêm tất cả các phụ thuộc được gợi ý kiểu trong chữ ký của phương thức nàynamespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
Lưu ý
Để tái sử dụng mã hiệu quả hơn, bạn nên giữ cho các lệnh trên bảng điều khiển của mình nhẹ nhàng và để chúng chuyển sang các dịch vụ ứng dụng để hoàn thành nhiệm vụ của chúng. Trong ví dụ trên, lưu ý rằng chúng tôi đưa vào một lớp dịch vụ để thực hiện "công việc nặng nhọc" gửi e-mail.
Lệnh đóng cửa
Các lệnh dựa trên đóng cửa cung cấp một giải pháp thay thế cho việc xác định các lệnh điều khiển dưới dạng các lớp. Cũng giống như cách đóng tuyến đường là một giải pháp thay thế cho bộ điều khiển, hãy nghĩ đến việc đóng lệnh như một giải pháp thay thế cho các lớp lệnh. Trong phương pháp
Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }31 của tệp
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
56 của bạn, Laravel tải tệp namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
57var obj = document.getElementsByTagName['name']; obj[0].value = "value"4
Mặc dù tệp này không xác định các tuyến HTTP, nhưng nó xác định các điểm vào dựa trên bảng điều khiển [các tuyến] vào ứng dụng của bạn. Trong tệp này, bạn có thể xác định tất cả các lệnh bảng điều khiển dựa trên đóng của mình bằng cách sử dụng phương thức
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
58. Phương thức namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
59 chấp nhận hai đối số. chữ ký lệnh và bao đóng nhận các đối số và tùy chọn của lệnhGán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }3
Bao đóng được liên kết với thể hiện lệnh cơ bản, vì vậy bạn có toàn quyền truy cập vào tất cả các phương thức của trình trợ giúp mà bạn thường có thể truy cập trên một lớp lệnh đầy đủ
Phụ thuộc gợi ý kiểu
Ngoài việc nhận các đối số và tùy chọn của lệnh của bạn, các lần đóng lệnh cũng có thể gợi ý loại phụ thuộc bổ sung mà bạn muốn giải quyết ngoài vùng chứa dịch vụ
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
5Mô tả lệnh đóng cửa
Khi xác định lệnh dựa trên đóng, bạn có thể sử dụng phương thức
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
90 để thêm mô tả cho lệnh. Mô tả này sẽ được hiển thị khi bạn chạy lệnh namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
91 hoặc namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
92namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
9Các lệnh cô lập
Cảnh báo Để sử dụng tính năng này, ứng dụng của bạn phải đang sử dụng trình điều khiển bộ đệm ẩn
93,
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
94,
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
95,
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
96,
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
97 hoặc
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
98 làm trình điều khiển bộ đệm mặc định cho ứng dụng của bạn. Ngoài ra, tất cả các máy chủ phải giao tiếp với cùng một máy chủ bộ đệm trung tâm
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
Đôi khi bạn có thể muốn đảm bảo rằng chỉ có một phiên bản của lệnh có thể chạy tại một thời điểm. Để thực hiện điều này, bạn có thể triển khai giao diện
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
99 trên lớp lệnh của mìnhcomposer require laravel/tinker
0Khi một lệnh được đánh dấu là
composer require laravel/tinker
00, Laravel sẽ tự động thêm tùy chọn composer require laravel/tinker
01 vào lệnh. Khi lệnh được gọi với tùy chọn đó, Laravel sẽ đảm bảo rằng không có phiên bản nào khác của lệnh đó đang chạy. Laravel thực hiện điều này bằng cách cố gắng lấy khóa nguyên tử bằng trình điều khiển bộ đệm mặc định của ứng dụng của bạn. Nếu các phiên bản khác của lệnh đang chạy, lệnh sẽ không thực thi; composer require laravel/tinker
1Nếu bạn muốn chỉ định mã trạng thái thoát mà lệnh sẽ trả về nếu nó không thể thực thi, bạn có thể cung cấp mã trạng thái mong muốn thông qua tùy chọn
composer require laravel/tinker
02composer require laravel/tinker
2Thời gian hết hạn khóa
Theo mặc định, khóa cách ly hết hạn sau khi lệnh kết thúc. Hoặc, nếu lệnh bị gián đoạn và không thể hoàn thành, khóa sẽ hết hạn sau một giờ. Tuy nhiên, bạn có thể điều chỉnh thời gian hết hạn khóa bằng cách xác định phương thức
composer require laravel/tinker
03 trong lệnh của mìnhcomposer require laravel/tinker
3Xác định kỳ vọng đầu vào
Khi viết các lệnh trên bàn điều khiển, thông thường sẽ thu thập thông tin đầu vào từ người dùng thông qua các đối số hoặc tùy chọn. Laravel làm cho việc xác định đầu vào mà bạn mong đợi từ người dùng trở nên rất thuận tiện bằng cách sử dụng thuộc tính
Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }39 trên các lệnh của bạn. Thuộc tính
Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }39 cho phép bạn xác định tên, đối số và tùy chọn cho lệnh theo một cú pháp đơn, biểu cảm, giống như tuyến đường
Tranh luận
Tất cả các đối số và tùy chọn do người dùng cung cấp được đặt trong dấu ngoặc nhọn. Trong ví dụ sau, lệnh xác định một đối số bắt buộc.
composer require laravel/tinker
06composer require laravel/tinker
4Bạn cũng có thể đặt đối số tùy chọn hoặc xác định giá trị mặc định cho đối số
composer require laravel/tinker
5Tùy chọn
Các tùy chọn, như đối số, là một dạng đầu vào khác của người dùng. Các tùy chọn được bắt đầu bằng hai dấu gạch ngang [
composer require laravel/tinker
07] khi chúng được cung cấp qua dòng lệnh. Có hai loại tùy chọn. những cái nhận được một giá trị và những cái không. Các tùy chọn không nhận được giá trị đóng vai trò là "công tắc" boolean. Chúng ta hãy xem một ví dụ về loại tùy chọn nàycomposer require laravel/tinker
6Trong ví dụ này, công tắc
composer require laravel/tinker
08 có thể được chỉ định khi gọi lệnh Artisan. Nếu công tắc composer require laravel/tinker
08 được thông qua, giá trị của tùy chọn sẽ là composer require laravel/tinker
10. Nếu không, giá trị sẽ là composer require laravel/tinker
11composer require laravel/tinker
7Tùy chọn có giá trị
Tiếp theo, chúng ta hãy xem một tùy chọn mong đợi một giá trị. Nếu người dùng phải chỉ định một giá trị cho một tùy chọn, bạn nên thêm dấu
composer require laravel/tinker
12 vào tên tùy chọn đócomposer require laravel/tinker
8Trong ví dụ này, người dùng có thể chuyển một giá trị cho tùy chọn như vậy. Nếu tùy chọn không được chỉ định khi gọi lệnh, giá trị của nó sẽ là
composer require laravel/tinker
13composer require laravel/tinker
9Bạn có thể gán giá trị mặc định cho tùy chọn bằng cách chỉ định giá trị mặc định sau tên tùy chọn. Nếu người dùng không chuyển giá trị tùy chọn, giá trị mặc định sẽ được sử dụng
var obj = document.getElementsByTagName['name']; obj[0].value = "value"10
Phím tắt tùy chọn
Để gán một lối tắt khi xác định một tùy chọn, bạn có thể chỉ định nó trước tên tùy chọn và sử dụng ký tự
composer require laravel/tinker
14 làm dấu phân cách để tách lối tắt khỏi tên tùy chọn đầy đủvar obj = document.getElementsByTagName['name']; obj[0].value = "value"11
Khi gọi lệnh trên thiết bị đầu cuối của bạn, các phím tắt tùy chọn phải được bắt đầu bằng một dấu gạch nối
Mảng đầu vào
Nếu bạn muốn xác định các đối số hoặc tùy chọn để mong đợi nhiều giá trị đầu vào, bạn có thể sử dụng ký tự
composer require laravel/tinker
15. Đầu tiên, chúng ta hãy xem một ví dụ xác định một đối số như vậyKhi gọi phương thức này, các đối số
composer require laravel/tinker
06 có thể được chuyển theo thứ tự tới dòng lệnh. Ví dụ: lệnh sau sẽ đặt giá trị của composer require laravel/tinker
06 thành một mảng có giá trị là composer require laravel/tinker
18 và composer require laravel/tinker
19Ký tự
composer require laravel/tinker
15 này có thể được kết hợp với một định nghĩa đối số tùy chọn để cho phép không hoặc nhiều phiên bản của đối sốMảng tùy chọn
Khi xác định một tùy chọn mong đợi nhiều giá trị đầu vào, mỗi giá trị tùy chọn được chuyển đến lệnh phải được thêm tiền tố vào tên tùy chọn
Một lệnh như vậy có thể được gọi bằng cách truyền nhiều đối số
composer require laravel/tinker
21var obj = document.getElementsByTagName['name']; obj[0].value = "value"12
Mô tả đầu vào
Bạn có thể gán mô tả cho các đối số và tùy chọn đầu vào bằng cách tách tên đối số khỏi mô tả bằng dấu hai chấm. Nếu bạn cần thêm một chút chỗ để xác định lệnh của mình, vui lòng trải rộng định nghĩa trên nhiều dòng
var obj = document.getElementsByTagName['name']; obj[0].value = "value"13
Lệnh vào/ra
Truy xuất đầu vào
Trong khi lệnh của bạn đang thực thi, bạn có thể sẽ cần truy cập các giá trị cho các đối số và tùy chọn được lệnh của bạn chấp nhận. Để làm như vậy, bạn có thể sử dụng các phương pháp
composer require laravel/tinker
22 và composer require laravel/tinker
23. Nếu một đối số hoặc tùy chọn không tồn tại, composer require laravel/tinker
13 sẽ được trả vềvar obj = document.getElementsByTagName['name']; obj[0].value = "value"14
Nếu bạn cần truy xuất tất cả các đối số dưới dạng
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
98, hãy gọi phương thức composer require laravel/tinker
26var obj = document.getElementsByTagName['name']; obj[0].value = "value"15
Các tùy chọn có thể được truy xuất dễ dàng như các đối số bằng phương thức
composer require laravel/tinker
23. Để truy xuất tất cả các tùy chọn dưới dạng một mảng, hãy gọi phương thức composer require laravel/tinker
28var obj = document.getElementsByTagName['name']; obj[0].value = "value"16
Nhắc nhập liệu
Ngoài việc hiển thị đầu ra, bạn cũng có thể yêu cầu người dùng cung cấp thông tin đầu vào trong quá trình thực thi lệnh của bạn. Phương thức
composer require laravel/tinker
29 sẽ nhắc người dùng với câu hỏi đã cho, chấp nhận đầu vào của họ và sau đó trả lại đầu vào của người dùng cho lệnh của bạnvar obj = document.getElementsByTagName['name']; obj[0].value = "value"17
Phương pháp
composer require laravel/tinker
30 tương tự như composer require laravel/tinker
29, nhưng đầu vào của người dùng sẽ không hiển thị với họ khi họ nhập vào bảng điều khiển. Phương pháp này hữu ích khi yêu cầu thông tin nhạy cảm như mật khẩuvar obj = document.getElementsByTagName['name']; obj[0].value = "value"18
Yêu cầu xác nhận
Nếu bạn cần yêu cầu người dùng xác nhận "có hoặc không" đơn giản, bạn có thể sử dụng phương pháp
composer require laravel/tinker
32. Theo mặc định, phương thức này sẽ trả về composer require laravel/tinker
11. Tuy nhiên, nếu người dùng nhập composer require laravel/tinker
34 hoặc composer require laravel/tinker
35 để phản hồi lời nhắc, phương thức sẽ trả về composer require laravel/tinker
10var obj = document.getElementsByTagName['name']; obj[0].value = "value"19
Nếu cần, bạn có thể chỉ định rằng lời nhắc xác nhận sẽ trả về
composer require laravel/tinker
10 theo mặc định bằng cách chuyển composer require laravel/tinker
10 làm đối số thứ hai cho phương thức composer require laravel/tinker
32Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }60
Tự động hoàn thành
Phương pháp
composer require laravel/tinker
40 có thể được sử dụng để cung cấp tính năng tự động hoàn thành cho các lựa chọn có thể. Người dùng vẫn có thể cung cấp bất kỳ câu trả lời nào, bất kể gợi ý tự động hoàn thànhGán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }61
Ngoài ra, bạn có thể chuyển một bao đóng làm đối số thứ hai cho phương thức
composer require laravel/tinker
40. Việc đóng sẽ được gọi mỗi khi người dùng nhập một ký tự đầu vào. Việc đóng cửa phải chấp nhận một tham số chuỗi chứa đầu vào của người dùng cho đến nay và trả về một loạt các tùy chọn để tự động hoàn thànhGán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }62
Câu hỏi trắc nghiệm
Nếu bạn cần cung cấp cho người dùng một tập hợp các lựa chọn được xác định trước khi đặt câu hỏi, bạn có thể sử dụng phương pháp
composer require laravel/tinker
42. Bạn có thể đặt chỉ mục mảng của giá trị mặc định được trả về nếu không có tùy chọn nào được chọn bằng cách chuyển chỉ mục làm đối số thứ ba cho phương thứcNgoài ra, phương thức
composer require laravel/tinker
42 chấp nhận các đối số thứ tư và thứ năm tùy chọn để xác định số lần thử tối đa để chọn một phản hồi hợp lệ và liệu có cho phép nhiều lựa chọn hay khôngGán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }63
Viết đầu ra
Để gửi đầu ra tới bàn điều khiển, bạn có thể sử dụng các phương thức
composer require laravel/tinker
44, composer require laravel/tinker
45, composer require laravel/tinker
46, composer require laravel/tinker
47, composer require laravel/tinker
48 và composer require laravel/tinker
49. Mỗi phương pháp này sẽ sử dụng các màu ANSI thích hợp cho mục đích của chúng. Ví dụ: hãy hiển thị một số thông tin chung cho người dùng. Thông thường, phương pháp composer require laravel/tinker
45 sẽ hiển thị trong bảng điều khiển dưới dạng văn bản màu xanh lụcGán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }64
Để hiển thị thông báo lỗi, hãy sử dụng phương pháp
composer require laravel/tinker
49. Văn bản thông báo lỗi thường được hiển thị bằng màu đỏGán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }65
Bạn có thể sử dụng phương pháp
composer require laravel/tinker
44 để hiển thị văn bản đơn giản, không màuGán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }66
Bạn có thể sử dụng phương pháp
composer require laravel/tinker
53 để hiển thị một dòng trốngGán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }67
Những cái bàn
Phương thức
composer require laravel/tinker
54 giúp dễ dàng định dạng chính xác nhiều hàng/cột dữ liệu. Tất cả những gì bạn cần làm là cung cấp tên cột và dữ liệu cho bảng và Laravel sẽ tự động tính toán chiều rộng và chiều cao phù hợp của bảng cho bạnGán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }68
Thanh tiến trình
Đối với các tác vụ chạy trong thời gian dài, có thể hữu ích khi hiển thị thanh tiến trình thông báo cho người dùng mức độ hoàn thành của tác vụ. Sử dụng phương thức
composer require laravel/tinker
55, Laravel sẽ hiển thị một thanh tiến trình và nâng cao tiến trình của nó cho mỗi lần lặp qua một giá trị có thể lặp lại nhất địnhGán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }69
Đôi khi, bạn có thể cần kiểm soát thủ công hơn đối với cách nâng cao thanh tiến trình. Đầu tiên, xác định tổng số bước mà quy trình sẽ lặp lại. Sau đó, chuyển tiếp thanh tiến trình sau khi xử lý từng mục
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
30Lưu ý
Để biết thêm các tùy chọn nâng cao, hãy xem tài liệu thành phần Thanh tiến trình Symfony.
Đăng ký lệnh
Tất cả các lệnh bảng điều khiển của bạn được đăng ký trong lớp
composer require laravel/tinker
56 của ứng dụng, là "nhân bảng điều khiển" của ứng dụng của bạn. Trong phương thức Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }31 của lớp này, bạn sẽ thấy một cuộc gọi đến phương thức
composer require laravel/tinker
58 của kernel. Phương thức composer require laravel/tinker
58 sẽ quét thư mục Gán giá trị function setDomain[]{ let domain = 'freetuts.net'; document.getElementById['domain'].value = domain; }35 và tự động đăng ký từng lệnh chứa trong đó với Artisan. Bạn thậm chí có thể tự do gọi thêm phương thức
composer require laravel/tinker
58 để quét các thư mục khác để tìm lệnh Artisannamespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
31Nếu cần, bạn có thể đăng ký các lệnh theo cách thủ công bằng cách thêm tên lớp của lệnh vào thuộc tính
composer require laravel/tinker
62 trong lớp composer require laravel/tinker
56 của bạn. Nếu thuộc tính này chưa được xác định trên kernel của bạn, bạn nên xác định nó theo cách thủ công. Khi Artisan khởi động, tất cả các lệnh được liệt kê trong thuộc tính này sẽ được giải quyết bởi bộ chứa dịch vụ và được đăng ký với Artisannamespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
32Các lệnh thực thi theo chương trình
Đôi khi bạn có thể muốn thực thi lệnh Artisan bên ngoài CLI. Ví dụ: bạn có thể muốn thực thi lệnh Artisan từ tuyến đường hoặc bộ điều khiển. Bạn có thể sử dụng phương pháp
composer require laravel/tinker
64 trên mặt tiền composer require laravel/tinker
65 để thực hiện việc này. Phương thức composer require laravel/tinker
64 chấp nhận tên chữ ký của lệnh hoặc tên lớp làm đối số đầu tiên và một mảng tham số lệnh làm đối số thứ hai. Mã thoát sẽ được trả lạinamespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
33Ngoài ra, bạn có thể truyền toàn bộ lệnh Artisan cho phương thức
composer require laravel/tinker
64 dưới dạng chuỗinamespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
34Truyền giá trị mảng
Nếu lệnh của bạn xác định một tùy chọn chấp nhận một mảng, bạn có thể chuyển một mảng giá trị cho tùy chọn đó
namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
35Truyền giá trị Boolean
Nếu bạn cần chỉ định giá trị của một tùy chọn không chấp nhận giá trị chuỗi, chẳng hạn như cờ
composer require laravel/tinker
68 trên lệnh composer require laravel/tinker
69, bạn nên chuyển composer require laravel/tinker
10 hoặc composer require laravel/tinker
11 làm giá trị của tùy chọnnamespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
36Lệnh thủ công xếp hàng
Sử dụng phương pháp
composer require laravel/tinker
72 trên mặt tiền composer require laravel/tinker
65, bạn thậm chí có thể xếp hàng các lệnh Artisan để chúng được xử lý trong nền bởi nhân viên xếp hàng của bạn. Trước khi sử dụng phương pháp này, hãy đảm bảo rằng bạn đã định cấu hình hàng đợi của mình và đang chạy trình xử lý hàng đợinamespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
37Sử dụng các phương thức
composer require laravel/tinker
74 và composer require laravel/tinker
75, bạn có thể chỉ định kết nối hoặc hàng đợi lệnh Artisan sẽ được gửi tớinamespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
38Gọi lệnh từ các lệnh khác
Đôi khi bạn có thể muốn gọi các lệnh khác từ lệnh Artisan hiện có. Bạn có thể làm như vậy bằng cách sử dụng phương pháp
composer require laravel/tinker
64. Phương thức composer require laravel/tinker
64 này chấp nhận tên lệnh và một mảng đối số lệnh/tùy chọnnamespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
39Nếu bạn muốn gọi một lệnh console khác và chặn tất cả đầu ra của nó, bạn có thể sử dụng phương thức
composer require laravel/tinker
78. Phương thức composer require laravel/tinker
78 có cùng chữ ký với phương thức composer require laravel/tinker
64namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
0Xử lý tín hiệu
Như bạn có thể biết, hệ điều hành cho phép gửi tín hiệu đến các tiến trình đang chạy. Ví dụ: tín hiệu
composer require laravel/tinker
81 là cách hệ điều hành yêu cầu chương trình chấm dứt. Nếu bạn muốn lắng nghe các tín hiệu trong các lệnh của bảng điều khiển Artisan và thực thi mã khi chúng xuất hiện, bạn có thể sử dụng phương pháp composer require laravel/tinker
82namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
1Để lắng nghe nhiều tín hiệu cùng một lúc, bạn có thể cung cấp một mảng tín hiệu cho phương thức
composer require laravel/tinker
82namespace App\Console\Commands;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
* The name and signature of the console command.
protected $signature = 'mail:send {user}';
* The console command description.
protected $description = 'Send a marketing email to a user';
* Execute the console command.
* @param \App\Support\DripEmailer $drip
public function handle[DripEmailer $drip]
$drip->send[User::find[$this->argument['user']]];
2Tùy chỉnh sơ khai
Các lệnh
composer require laravel/tinker
84 của bảng điều khiển Artisan được sử dụng để tạo nhiều lớp khác nhau, chẳng hạn như bộ điều khiển, công việc, di chuyển và thử nghiệm. Các lớp này được tạo bằng các tệp "sơ khai" được điền các giá trị dựa trên thông tin đầu vào của bạn. Tuy nhiên, bạn có thể muốn thực hiện các thay đổi nhỏ đối với các tệp do Artisan tạo. Để thực hiện điều này, bạn có thể sử dụng lệnh composer require laravel/tinker
85 để xuất bản các sơ khai phổ biến nhất cho ứng dụng của mình để bạn có thể tùy chỉnh chúng.Các sơ khai đã xuất bản sẽ nằm trong thư mục
composer require laravel/tinker
86 trong thư mục gốc của ứng dụng của bạn. Bất kỳ thay đổi nào bạn thực hiện đối với các sơ khai này sẽ được phản ánh khi bạn tạo các lớp tương ứng của chúng bằng cách sử dụng các lệnh Artisan's composer require laravel/tinker
84Sự kiện
Artisan gửi ba sự kiện khi chạy lệnh.
composer require laravel/tinker
88, composer require laravel/tinker
89 và composer require laravel/tinker
90. Sự kiện composer require laravel/tinker
91 được gửi đi ngay lập tức khi Artisan bắt đầu chạy. Tiếp theo, sự kiện composer require laravel/tinker
92 được gửi ngay trước khi lệnh chạy. Cuối cùng, sự kiện composer require laravel/tinker
93 được gửi đi sau khi lệnh thực thi xong