# Routing w Laravel (Laravel) > Podstawowe trasy, parametry, named routes, route groups, middleware, resource routes, route model binding - 20 pytań z rozmów - Junior - [Pytania z rozmów: Laravel](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne.md) ## 1. Jak zdefiniować podstawową trasę GET w Laravel? **Odpowiedź** Metoda Route::get() definiuje trasę odpowiadającą na żądania HTTP GET. Pierwszym parametrem jest URI, drugim closure lub tablica [Controller::class, 'method']. To podejście definiuje się w routes/web.php lub routes/api.php w zależności od typu trasy. ## 2. Której metody użyć, aby utworzyć trasę odpowiadającą na wiele czasowników HTTP? **Odpowiedź** Route::match() przyjmuje jako pierwszy parametr tablicę czasowników HTTP, następnie URI i akcję. Pozwala to na przykład odpowiadać na GET i POST na tej samej trasie. Istnieje też Route::any(), aby odpowiadać na wszystkie czasowniki HTTP, ale match() oferuje precyzyjniejszą kontrolę. ## 3. Jak przechwycić parametr w adresie URL trasy? **Odpowiedź** Parametry trasy definiuje się za pomocą nawiasów klamrowych {param} w URI. Są one automatycznie wstrzykiwane do closure lub metody kontrolera. Parametry można uczynić opcjonalnymi za pomocą {param?} oraz nałożyć na nie ograniczenia za pomocą ->where(). ## Jeszcze 17 dostępnych pytań - Jak dodać ograniczenie regex do parametru trasy? - Jak nazwać trasę, aby łatwo ją wielokrotnie używać? Zarejestruj się za darmo: https://sharpskill.dev/pl/login ## Inne tematy rekrutacyjne Laravel - [Podstawy PHP](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/php-basics.md): 25 pytań, Junior - [Podstawy programowania obiektowego w PHP](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/php-oop-essentials.md): 20 pytań, Junior - [Composer & Autoloading](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/composer-autoloading.md): 18 pytań, Junior - [Podstawy Laravel](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/laravel-fundamentals.md): 20 pytań, Junior - [Blade Templates](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/blade-templates.md): 18 pytań, Junior - [Request & Response](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/request-response.md): 20 pytań, Junior - [Podstawy Eloquent ORM](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/eloquent-orm-basics.md): 22 pytań, Junior - [Eloquent Relationships](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/eloquent-relationships.md): 25 pytań, Mid-Level - [Migrations & Schema Builder](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/database-migrations.md): 20 pytań, Mid-Level - [Walidacja i formularze](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/validation-forms.md): 22 pytań, Mid-Level - [Uwierzytelnianie](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/authentication.md): 20 pytań, Mid-Level - [Autoryzacja i Policies](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/authorization-policies.md): 18 pytań, Mid-Level - [API Resources & Authentication](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/api-resources-authentication.md): 26 pytań, Mid-Level - [Middleware](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/middleware.md): 18 pytań, Mid-Level - [Service Container & DI](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/service-container-di.md): 20 pytań, Mid-Level - [Queues & Jobs](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/queues-jobs.md): 22 pytań, Mid-Level - [Events & Listeners](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/events-listeners.md): 18 pytań, Mid-Level - [Powiadomienia & Mail](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/notifications-mail.md): 20 pytań, Mid-Level - [File Storage](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/file-storage.md): 18 pytań, Mid-Level - [Testing & PHPUnit](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/testing-phpunit.md): 24 pytań, Mid-Level - [Caching](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/caching.md): 18 pytań, Mid-Level - [Livewire & Inertia](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/livewire-inertia.md): 20 pytań, Mid-Level - [Eloquent Advanced](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/eloquent-advanced.md): 24 pytań, Senior - [Repository Pattern](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/repository-pattern.md): 20 pytań, Senior - [Laravel Packages](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/laravel-packages.md): 20 pytań, Senior - [Performance Optimization](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/performance-optimization.md): 22 pytań, Senior - [Security Best Practices](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/security-best-practices.md): 22 pytań, Senior - [Laravel Octane](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/laravel-octane.md): 18 pytań, Senior - [Laravel Distributed Systems](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/laravel-distributed-systems.md): 22 pytań, Senior - [Observability & Monitoring](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/observability-monitoring.md): 20 pytań, Senior - [Deployment & DevOps](https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/deployment-devops.md): 20 pytań, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/pl/technologies/laravel/pytania-rekrutacyjne/laravel-routing