Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to access a file from view folder to frontend in laravel 5.8?

Tags:

laravel

i have a file called "index.blade" in a view inside a folder name "home". now i am trying to make that folder as my front end for 127.0.0.1:8000 . it is showing me error as tried to give routes.

i have tried to used controller named FrontendController to provide route

ErrorException (E_ERROR) Undefined variable: students (View: D:\xampp\htdocs\Student01\resources\views\home\index.blade.php)

like image 272
Kshitiz Dhungel Avatar asked Jan 18 '26 06:01

Kshitiz Dhungel


1 Answers

issue with students variable.

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Students; 

class FrontendController extends Controller
{
 public function index()
    {
        $students = Students::get();
        return view('home.index', compact('students'));
    }
}
like image 104
Shankar S Bavan Avatar answered Jan 20 '26 12:01

Shankar S Bavan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!