Cześć! Skoro już tu jesteś, może zainteresuje Cię moja książka "Advanced PHP Strings: Text analysis, generation, and parsing via. Laravel", który obejmuje analizowanie tekstu, manipulowanie ciągami znaków, zarządzanie kodowaniem znaków i wiele innych.
Książka zawiera ponad 700 stron szczegółowych dyfuzji od pomocników Laravel do pisania parsera Gherkin and Blade.
Za pomocą tego route:list
polecenia można wyświetlić listę wszystkich zarejestrowanych tras dla aplikacji. To polecenie wyświetli domenę, metodę, identyfikator URI, nazwę, akcję i oprogramowanie pośredniczące dla tras zawartych w wygenerowanej tabeli.
Poniższy przykład ilustruje, jak używać polecenia bez żadnych opcji:
php artisan route:list
It will generate a table similar to the following output (the exact table entries will depend on the registered routes).
Tabelę routes można filtrować przy użyciu różnych opcji definiowanych przez polecenie. W poniższej tabeli wymieniono i opisano poszczególne opcje obsługiwane przez polecenie. Niektóre opcje obsługują filtry dostarczone przez użytkownika, które są oznaczone przez pojawiające <TERM>
się w nazwie opcji. Zastąp <TERM>
wartością filtrowania podczas uruchamiania polecenia.
Option Name | Description | Default Value |
---|---|---|
--method=<TERM> |
Filters the routes by method. | None |
--name=<TERM> |
Filters the routes by name. | None |
--path=<TERM> |
Filters the routes by path (URI). | None |
--reverse |
Reverses the order the routes are displayed in the table. | None |
-r |
Reverses the order the routes are displayed in the table (shortcut to --reverse ). |
None |
--sort |
The column to sort by. Accepted values are host , method , uri , name, action or middleware . |
uri |
Poniższe przykłady pokazują skutki różnych opcji.
Filtrowanie tras według nazwy:Ten sam proces można powtórzyć dla --method
opcji i i--path
:Poniższe przykłady pokazują, jak wywołać polecenie z różnymi innymi opcjami:
# Filter the route list by name.
php artisan route:list --name=account
After the above command has executed, a table will be generated that only contains routes that have account
in the name
column:
# Filter the route list by URI.
php artisan route:list --path=account
# Filter the route list by method.
php artisan route:list --method=GET
The filters can be combined; results will be aggregated using "and" logic. The following command:
php artisan route:list --path=account --method=GET
can be interpreted as "find all routes that contain account
in the URI and contain GET
in the method."
# Filter the routes and display them in reverse order.
php artisan route:list --method=GET --reverse
# The following is equivalent to the previous example.
php artisan route:list --method=GET -r
# Filter the routes and sort `name` column.
php artisan route:list --method=GET --sort=name