简体   繁体   中英

How to call php files placed outside laravel folder from laravel controller

I have laravel project on my localhost the name is blog , and I have some php files in tmrate folder which is located oulside the blog

path for laravel project- www/blog
path for php files -www/tmrate/.php files

I write following route:

Route::get('/tmrate/{id}','WebServiceController@getTmrate');
Route::post('/tmrate/{id}','WebServiceController@postTmrate');

In WebServiceController I have following code,

public function getTmrate($id){
    $tmrate=DB::table('team_rating')->where('teamId',$id)->first();
        if($tmrate->rating==''){
             return view('tmrate.rateUs')->with('tmrate',$tmrate);
        }else{
         return view('tmrate.alreadyRatedUs');
        }
    }

whenever I put tmrate folder in resources/views it is working fine , but I want to place tmrate folder outsisde project folder and return view something like this

return view('www.tmrate.rateUs') or ('www.tmrate.rateUs.php')

But It wasn't working do you have any suggestions.

You have to set (in config/view.php file) the second path where the Laravel should look for your views. The order is important , the framework will check paths from the first to the last element in the above array (so you can have views in both folders, but the first matching will be used).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM