• Czas czytania ~2 min
  • 08.04.2023
 
 

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).

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:

Filtered routes

# 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

Comments

No comments yet
Yurij Finiv

Yurij Finiv

Full stack

O

Professional Fullstack Developer with extensive experience in website and desktop application development. Proficient in a wide range of tools and technologies, including Bootstrap, Tailwind, HTML5, CSS3, PUG, JavaScript, Alpine.js, jQuery, PHP, MODX, and Node.js. Skilled in website development using Symfony, MODX, and Laravel. Experience: Contributed to the development and translation of MODX3 i...

O autorze CrazyBoy49z
WORK EXPERIENCE
Kontakt
Ukraine, Lutsk
+380979856297