1
votes

I used Laravel route as follow.

    Route::get('report/centos7/{id}', 'HomeController@centos7');

And then in Controller, I used this code to return View.

    \View::make('report/centos7/', $id);

An error occurred as follow.

    InvalidArgumentException in FileViewFinder.php line 137:
    View [report.centos7.] not found.

I called the URL like this "mysite/laravelproject/public/report/centos7/result_target2"

I using Laravel 5.2 First time I used this code in Controller return \View::make('report/centos7/'. $id); But, the CSS and JS is not loaded. I think because of "." That is why I changed from "." to ","

Route

Route::get('report/centos7/{id}', 'HomeController@centos7');

HomeController

public function centos7($id)
{
    //
    return \View::make('report/centos7', $id);
}

I had dynamically added "blade.php" into folder view/report/centos7/xxxx.blade.php I created a new page to list all files in that folder and link each of the files to show the report in blade format. I hope Laravel route to Controller is can help to access my report in blade format Thanks for help. I'm a newbie in programming language

Update

I removed {id} in route as follow

Route::get('report/centos7/{id}', 'HomeController@centos7');

To

Route::get('report/centos7/', 'HomeController@centos7');

And removed id in HomeController as well It works. But, I still want to send $id from Route to HomeController When I do that I don't know why CSS is not loaded in my blade php. Please help.

Update (Sovled)

Thank god everyone If anyone has the same problem as me I changed my href into the layout as follow and it works.

<link href="{{ URL::asset('theme/vendor/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
1

1 Answers

0
votes

The main issue is the extra / in your view code:

\View::make('report/centos7/', $id);

If you change it to the following, it should all work correctly:

\View::make('report.centos7', $id);

Make sure that your HTML code is in the resources/views/report/centos7.blade.php file.