18. Which of the following is correct command to save an uploaded file?

$request->file(‘avatar’)->store(‘avatars’);

$request->input(‘avatar’)->store(‘avatars’);

$request->file(‘avatar’)->save(‘avatars’);

$request->input(‘avatar’)->save(‘avatars’);

Ans(A: )

19. Which of the following loops are available in blade? (choose all that apply)

Note: There may be more than one right answer.

@for ($i = 0; $i < 10; $i++)

The current value is {{ $i }}

@endfor

@foreach ($users as $user)

<p>This is user {{ $user->id }}</p>

@endforeach

@forelse ($users as $user)

<li>{{ $user->name }}</li>

@empty

<p>No users</p>

@endforelse

@while (true)

<p>I’m looping forever.</p>

@endwhile

Ans(all)

21. Which of the following is correct to redirect named route ‘photos.index’?

No answer is correct according to doc ….

Route::get(‘redirect’, function () {

return Redirect::to(‘photos.index’);

});

Route::get(‘redirect’, function () {

return Redirect::route(‘photos.index’);

});

Route::get(‘redirect’, function () {

return Redirect(‘photos.index’);

});

Route::get(‘redirect’, function () {

return Redirect::route(‘photos’);

});

22. If you need to add additional routes to a resource controller beyond the default set of resource routes, you should define those routes after your call to Route::resource

True

False

Ans: TRUE

23. Which of the following variable is available inside your loops in blade?

$iterate

$first

$index

$loop

Ans(D: )

25. ____ are an important part of any web-based application. They help control the flow of the application which allows us to receive input from our users and make decisions that affect the functionality of our applications.

Routing

Module

Views

Forms

Ans (A: )

26. Which of the following is correct to loop over an array named $lists in view?

<ul>

@foreach ($lists as $list)

<li>{{ $list }}</li>

@endforeach

</ul>

<ul>

{ foreach ($lists as $list) }

<li>{{ $list }}</li>

{ endforeach }

</ul>

<ul>

@foreach ($list as $lists)

<li>{{ $list }}</li>

@endforeach

</ul>

<ul>

@foreach ($lists as $list)

<li>{{ $list }}</li>

@end

</ul>

Ans(A: )

27. Which of the following are correct regular expression route constraints?

Note: There may be more than one right answer.

Route::get(‘users/{id}’, function ($id) {

//

})->where(‘id’, ‘[0-9]+’);

Route::get(‘users/{username}’, function ($username) {

//

})->where(‘username’, ‘[A-Za-z]+’);

Route::get(‘posts/{id}/{slug}’, function ($id, $slug) {

//

})->where([‘id’ => ‘[0-9]+’, ‘slug’ => ‘[A-Za-z]+’]);

Route::get(‘users/id’, function ($id) {

//

})->where(‘id’, ‘[1-9]+’);

Ans (All)

28. Which of the following is/are correct to define custom validation messages?

Note: There may be more than one right answer.

Pass the custom messages as the third argument to the Validator::make method

Specify your custom messages in a language file.

Customize the error messages used by the form request by overriding the messages method.

Ans: (All)

29. Which command should be used to run all outstanding migration?

php artisan migrate:migration_name

php artisan migrate

php artisan create:migration

php artisan generate:migration

Ans: (B: )

30. Which of the following validator methods returns ‘True’ when form data is valid?

fails()

passes()

valid()

success()

Ans (B: )

31. Which of the following are correct route definitions? (Choose all that apply)

Note: There may be more than one right answer.

Route::match([‘get’, ‘post’], ‘/’, function () {});

Route::any(‘/’, function () {});

Route::delete(‘/’, function () {});

Route::put(‘/’, function () {});

Ans(All)

32. To use

@section(‘content’)

Welcome to your application dashboard!

@endsection

in your blade view what else should be there at the top?

@yeild(‘layouts.master’)

@extends(‘layouts.master’)

@include(‘layouts.master’)

@require(‘layouts.master’)

33. Which of the following routes are created by below route declaration? (Choose all that apply)

Route::resource(‘photos’, ‘PhotoController’);

Note: There may be more than one right answer.

/photos

/photos/create

/photos/{photo}/edit

/photos/{photo}/delete

34.Which of the following is convenient and correct way to automatically inject the model instances directly into your routes?

Route::get(‘api/users/{user}’, function ($user) {

return $user->email;

});

Route::get(‘users/{user}’, function (App\User $user) {

return $user->email;

});

Route::get(‘users/{id}’, function (App\User $user) {

return $user->email;

});

Ans (B)

35. Which of the following methods can be used to retrieve the record as an object containing the column names and the data stored in the record?

get()

find()

add()

insert()

Ans(B : )

36. If you don’t want Eloquent to automatically manage created_at and updated_at columns, which of the following will be correct?

About Us

W3ctrl is all about Software Development and Web Development on a larger perspective and more emphasis is given to Customize Business Software Development and Web Development. We are providing the best E-commerce solution for your business with the latest technology and marketing strategy.