Let's say you have several languages folders like resources/lang/en and resources/lang/es. Where would the default language be set? In which file?
AnswerAfter running artisan make:auth - what new controller will be generated?
AnswerLook at the code snippet. If that middleware fails, what HTTP code would be returned?
Route::put('/post/{post}', function (Post $post) {
// The current user may update the post...
})->middleware('can:update,post');
Answer
What are the methods used in database migrations classes?
AnswerThis command will roll back all of your migrations and then execute the migrate command. This command effectively re-creates your entire database.
AnswerLook at the snippet below - command generates the test. What does the class extend? What's behind XXXXXX?
php artisan make:test UserTest
class UserTest extends XXXXXX
{
// ...
Answer
Look at the code snippet. What relationship will it actually make?
class Comment extends Model
{
/**
* Get the post that owns the comment.
*/
public function post()
{
return $this->belongsTo('App\Post', 'post_id', 'post_id');
}
}
Answer
What is Blade syntax to show a variable, avoiding error if the variable is not defined? (and then showing empty string)
AnswerIn Laravel 5, all controllers by default should extend Controller. If you want to edit or add some code to that "main" controller, where is it located?
AnswerWhen using the daily log mode (files like laravel-2016-12-09.log), Laravel by default will only retain X days of log files by default. X = ?
AnswerIn default Laravel Auth, when user fills in email in "Forgot password", where the generated token is stored?
AnswerSee snippet below - user is redirected with flashed data. How that 'status' variable can be used after redirect?
return redirect('dashboard')->with('status', 'Profile updated!');
Answer
Look at code snippet. What would this touch() function do?
$user = User::find(1);
$user->touch();
Answer
Look at the code snippet. This was introduced in which Laravel version?
if (Gate::forUser($user)->allows('update-post', $post)) {
//
}
if ($request->user()->can('update-post', $post)) {
// ... Update post
}
@can('update-post', $post)
Edit Post
@endcan
Answer
After running "artisan down", your project will show maintenance page. What HTTP Status Code it would return?
AnswerWhat is the minimum PHP version required to install Laravel 5.3?
AnswerSee code snippet. What's the word behind XXXXXXXX?
@XXXXXXXX ($users as $user)
This is user {{ $user->id }}
@empty
No users found.
@endXXXXXXXX
Answer
You want to get the last (newest) registered user. What is behind XXXXXX?
$user = DB::table('users')->XXXXXX()->first();
Answer
Look at the code snippet - in database migrations rollback, you usually run something like this. What is another function that additionally checks if that table actually exists?
Schema::drop('users');
Answer
Look at the code snippet of dropping a foreign key. What if you don't know the exact name of that key? Is it possible to drop the key only by field name? How would it look?
$table->dropForeign('posts_user_id_foreign');
Answer
© 2017 QuizBucket.org