Dexter Siah
Dexter Siah

Reputation: 333

Not Locating My Blade File (Laravel + Voyager)

Hey guys i'm trying to make a custom view generate.blade.php in laravel(voyager) with a custom resource controller GeneratePdfController but whenever i click the button that redirects me to the view it and tell me that "Sorry, the page you are looking for could not be found." .The location of all the files are located at the default directory except for the pdf-page.blade.php. Anyone able to point out what am i missing inside?.

web.php

Route::get('/dashboard/attendance/generate', 'GeneratePdfController@index');
Route::resource('generateReport','GeneratePdfController');

GeneratePdfController

use Illuminate\Http\Request;
use App\Attendance;

class GeneratePdfController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $att = Attendance::all();

        return view('generate')->with('attt',$att);
    }

}

generate.blade.php

@extends('master')
@section('content')
    <form method="post" action="{{url('generateReport')}}">
          <!-- To Do Functions -->
    </form>
@endsection

pdf-page.blade.php

This blade is located in the \app\vendor\tcg\voyager\resources\views\partials

<a class="btn btn-primary" id="bulk_delete_btn"  href="{{url('/dashboard/attendance/generate')}}"><i class="voyager-trash"></i> <span>Generate Report</span></a>

EDIT

From the research i have done, i suspect that by default voyager will not search for the blade file and other controller in other sub folders aside from TCGsub folders. Then i tried making a blade file inside Vendor/TCG/voyager/resource/views and added a in function in the VoyagerController to return the view and edited the voyager.php with a Route::get but it did not work either. Anyone able to help?

Upvotes: 1

Views: 1928

Answers (1)

Moth
Moth

Reputation: 96

I am beginner too but I might have done something similar: I added a route 'admin/test/' to the file -> laravel-project/vendor/tcg/voyager/routes/voyager.php which looks like plain old laravel route:

enter image description here

The blade view is actually located in laravel-project/views/ directory. It has the following code: enter image description here

Which gives me something like this if I visit the route '/admin/test':

enter image description here

Hope this helps.

Upvotes: 1

Related Questions