New: NativePHP Starter-Kit

Quizzes: Laravel • The Basics • Routing - Results

52% (14/27)

You may constrain the format of your route parameters using which methods on a route instance. (Select all that apply) Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#parameters-regular-expression-constraints

You may constrain the format of your route parameters using which methods on a route instance. (Select all that apply)

Laravel can automatically respond to CORS OPTIONS HTTP requests with values that you configure. Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#cors

Explanation/Notes: All CORS settings may be configured in your application's config/cors.php configuration file. The OPTIONS requests will automatically be handled by the HandleCors middleware that is included by default in your global middleware stack. Your global middleware stack is located in your application's HTTP kernel (App\Http\Kernel).
Laravel can automatically respond to CORS OPTIONS HTTP requests with values that you configure.

Which of the following are not available router methods. (Select all that apply) Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#available-router-methods

Which of the following are not available router methods. (Select all that apply)

HTML forms do not support PUT, PATCH, or DELETE requests, so you must add the following to your form to spoof the method: (Assume the example form requires the PUT method) Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#form-method-spoofing

HTML forms do not support PUT, PATCH, or DELETE requests, so you must add the following to your form to spoof the method: (Assume the example form requires the PUT method)

If you need to specify a route parameter that may not always be present in the URI. You may do so by placing a ? mark _______ the parameter name. Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#parameters-optional-parameters

If you need to specify a route parameter that may not always be present in the URI. You may do so by placing a ? mark _______ the parameter name.

When using route parameters in redirect routes, the following parameters are reserved by Laravel and cannot be used. (Select all that apply): Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#redirect-routes

When using route parameters in redirect routes, the following parameters are reserved by Laravel and cannot be used. (Select all that apply):

When using route parameters in view routes, the following parameters are reserved by Laravel and cannot be used. (Select all that apply): Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#redirect-routes

When using route parameters in view routes, the following parameters are reserved by Laravel and cannot be used. (Select all that apply):

If your route has dependencies that you would like the Laravel service container to automatically inject into your route's callback, you should list your route parameters _______ your dependencies. Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#parameters-and-dependency-injection

If your route has dependencies that you would like the Laravel service container to automatically inject into your route's callback, you should list your route parameters _______ your dependencies.

To register an explicit binding, you use the router's ________ method to specify the class for a given parameter. You should define your explicit model bindings at the ________ of the ________ method of your RouteServiceProvider class. Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#explicit-binding

To register an explicit binding, you use the router's ________ method to specify the class for a given parameter. You should define your explicit model bindings at the ________ of the ________ method of your RouteServiceProvider class.

Which of the following would match any HTTP verb for the given route: Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#available-router-methods

Which of the following would match any HTTP verb for the given route:

You can return a view directly from a route. Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#view-routes

Explanation/Notes: If your route only needs to return a view, you may use the Route::view method. Like the redirect method, this method provides a simple shortcut so that you do not have to define a full route or controller. The view method accepts a URI as its first argument and a view name as its second argument. In addition, you may provide an array of data to pass to the view as an optional third argument.
You can return a view directly from a route.

Which of these would produce a route with the name "frontend.profile"? (Select all that apply) Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#named-routes

Which of these would produce a route with the name "frontend.profile"? (Select all that apply)

Which method would you use if you would like a route parameter to always be constrained by a given regular expression? Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#parameters-global-constraints

Which method would you use if you would like a route parameter to always be constrained by a given regular expression?

What does the following route closure do? Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#fallback-routes

1Route::fallback(function () {
2 //
3});
Explanation/Notes: The fallback route should always be the last route registered by your application.
What does the following route closure do?

If you would like model binding to always use a database column other than id when retrieving a given model class, you may override the _________ method on the Eloquent model. Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#customizing-the-default-key-name

If you would like model binding to always use a database column other than id when retrieving a given model class, you may override the _________ method on the Eloquent model.

Which of the following Route Model Bindings would not work? Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#implicit-binding

Explanation/Notes: Since the $user variable is type-hinted as the App\Models\User Eloquent model and the variable name matches the {user} URI segment, Laravel will automatically inject the model instance that has an ID matching the corresponding value from the request URI.
Which of the following Route Model Bindings would not work?

Which of the following are available to get information about the current route? (Select all that apply) Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#accessing-the-current-route

Which of the following are available to get information about the current route? (Select all that apply)

If the incoming request does not match the route pattern constraints, a ___ HTTP response will be returned. Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#parameters-regular-expression-constraints

If the incoming request does not match the route pattern constraints, a ___ HTTP response will be returned.

By default, what would the following URL be: Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#the-default-route-files

1// routes/api.php
2 
3Route::get('/user', [UserController::class, 'index']);
Explanation/Notes: Routes defined in the routes/api.php file are nested within a route group by the RouteServiceProvider. Within this group, the /api URI prefix is automatically applied so you do not need to manually apply it to every route in the file. You may modify the prefix and other route group options by modifying your RouteServiceProvider class.
By default, what would the following URL be:

Which of the following is the most basic route? Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#basic-routing

Which of the following is the most basic route?

By default, what status code does the following return: Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#redirect-routes

1Route::redirect('/here', '/there');
Explanation/Notes: By default, Route::redirect returns a 302 status code. You may customize the status code using the optional third parameter. Or, you may use the Route::permanentRedirect method to return a 301 status code.
By default, what status code does the following return:

The Routes loaded from the ______ routes file are loaded within the ______ middleware group. Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#the-default-route-files

The Routes loaded from the ______ routes file are loaded within the ______ middleware group.

Which of the following would match both the `get` and `post` HTTP verbs: Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#available-router-methods

Which of the following would match both the `get` and `post` HTTP verbs:

When using a middleware route group, the middleware are executed in the order they are listed in the array. Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#route-group-middleware

When using a middleware route group, the middleware are executed in the order they are listed in the array.

Any HTML forms pointing to ______ routes that are defined in the ______ routes file should include a ______ token field. Version: 8.x • Documentation: https://laravel.com/docs/8.x/routing#csrf-protection

Any HTML forms pointing to ______ routes that are defined in the ______ routes file should include a ______ token field.

Permalink: https://rappasoft.com/quizzes/laravel/routing/fca206bd-ec09-4559-9af6-4e35edb2fca0/results

You can also get here with laravel-quizzes.com