laravel views

 view contain html code of our application

stored in resources/views/blades

return view()

Route::view('/wishlist', 'ui.wishlist')->name('wishlist_page');

nesting views

user/folder-1/view.blade

user/view.blade

return view('user.folder-1.view) called as nesting view



view exxists

if that blade available , it shows that blade,


use illuminate/support/facades/view;

if(view::exists('user.view_existence')

{

return view('user.vuew_existence');

} else

{
return 'viewis unavailbe'

}



passing data to views

by usingth ename array

return view('admin.product.create',['brand_1'=>'vamsi','brand_2'=>'vamsi']);

in blade {{$brand_1}}

return view('admin.product.create',['brand_1'=>['vamsi','krishna'],'brand_2'=>'vamsi']);

e {{$brand_1[0]}}

by using with function

functioin($id){

return view('admin.product.create')->with('id',$id);

route::get('/with-function/{id}',[usercontroller:class,'withfunction']);

blade -> {{$id}}

by using 

compact function

return view('admin.product.create',compact('menus','product'));


php artisan view:cache


  1. _____ provide a convenient way to place all of our HTML in separate files.

    Marked Answer : Views

    Correct Answer : Views

  2. Views stored in the ______ directory.

    Marked Answer : resources/views

    Correct Answer : resources/views

  3. Which file extension informs the framework that the file contains a Blade template?

    Marked Answer : .blade.php

    Correct Answer : .blade.php

  4. Which global helper is used to return view file?

    Marked Answer : view

    Correct Answer : view

  5. Which View facade method is used to determine if view exists or not?

    Marked Answer : exists

    Correct Answer : exists

  6. Which artisan command is used to precompile all of the views utilized by the application?

    Marked Answer : view:cache

    Correct Answer : view:cache

No comments:

Post a Comment

Event listening in react

 How we can listen to som eevents some envents fire like click or automatically user enters into input button , that is event on word type i...