2

I am new to laravel. I have two files in two different folders. I can't access one through other.

views/layouts/header.blade.php
views/buysalerent/buy.blade.php

I want to add header.blade.php to buy.blade.php.

1 Answer 1

2

As you are using blade templating engine, you can include one view into another view like below

In buy.blade.php, just add

@include('layouts.header')

With the above line, header will be included into your buy.blade.php

Sign up to request clarification or add additional context in comments.

5 Comments

According to your suggestion I @include('layouts.header') this . But it does not work .
Can you please share both views code, so that I can check what is happening wrong?
Hi , I fix the problem .
Hi Russel, I am glad to hear that you fixed the problem. Can you please share your solution. So that it can be helpful to others :-)
Hi , I fix the problem . I change code in route Route::get('buysalerent/buy',['uses' => 'RentalController@buy']); to Route::get('/buy', 'RentalController@buy')->name('buy'); and add extends('layouts.header'); to buy.blade.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.