JOBSEEKER?

Laravel Interview Questions

Practice for Laravel interviews by solving TestDome questions. Our interview questions are used by more than 7,000 companies and 450,000 individual test takers.

Jobseekers: Certify Your Knowledge

Take a Certification Test

Companies: Use Our Tests for Screening

Buy a Pack Of Candidates

Need to practice your Laravel skills for an upcoming job interview? Try solving these Laravel interview questions that test knowledge of Laravel concepts such as controllers, Blade templates, and routing. We’ll provide feedback on your answers, and you can use a hint if you get stuck.

These Laravel interview questions are examples of real tasks used by employers to screen job candidates such as PHP developers, web developers, Laravel developers, and others that require knowledge of the PHP programming language and the Laravel framework.

1. HR routes

Easy 
Laravel HTTP Routing View New Public

An HR department uses the following Laravel resources to get employee data:

Route::get('/employee/{id?}', function ($id = 0) {
    return view('employee');
});
Route::get('/employee/{id}/subordinates/', function ($id) {
    return view('subordinates');
});

A request to "/employee/" will get mapped to the _____________ view.

A request to "/employee/12" will get mapped to the _____________ view.

A request to "/employee/10/subordinates/0" will get mapped to the _____________ view.

A request to "/employee/10/subordinates" will get mapped to the _____________ view.

Solve Question

2. Petting Zoo

Easy 
Laravel Controller View New Public

A petting zoo is using the following Laravel controller:

class AnimalController extends Controller
{
    public function animalDetailsByName(Request $request, $animalName)
    {
        return View::make('welcome', ['fullAnimalName' => $animalName]);
    }
}

What can be concluded about the controller and the view it returns?

(Select all acceptable answers.)

Solve Question

3. Cinema Movies

Easy 
Laravel Blade template View New Public

A cinema is using Laravel and Blade templates for their website. Their page at /movies should list all their movies and their directors. The relevant Laravel code is shown here:

class Movie
{
    public string $title;
    public string $director;

    function ̲ ̲ construct(string $title, string $director)
    {
        $this->title = $title;
        $this->director = $director;
    }
}

Route::get('/movies', function ()
{
    $movies = [new Movie("Casablanca", "Michael Curtiz"), new Movie("Psycho", "Alfred Hitchcock")];
    return View::make('welcome', ['movies' => $movies]);
});

Fill in the blanks for the following welcome.blade.php Blade template so that it prints correct data:

<!DOCTYPE html>
<html>
  <head>
    <title>Movies</title>
  </head>
  <body>
    <div>
      @_______________(________ as $movie)
         <p>Movie title: {{ ________________ }}, director: {{ ________________ }}</p>
      @_____________
    </div>
  </body>
</html>
Solve Question

If you feel ready, take one of our timed public Laravel Interview Questions tests:
PHP

Laravel Online Test (Easy)

PHP and Laravel Online Test (Easy / Hard)

Not exactly what you are looking for? Go to our For Jobseekers section.
Dashboard Start Trial Sign In Home Tour Tests Questions Pricing For Jobseekers