Hi,
I am having some trouble with rendering a custom template on a custom route. The custom template does not seem to render within de: web/app/themes/sage/index.php
I except the template to render within in the:
<?php echo view(app('sage.view'), app('sage.data'))->render(); ?>
I am running the following code in my service provider:
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
Route::get('/event/{slug}', function ($slug) {
$post = get_page_by_path($slug, OBJECT, 'tribe_events');
if(empty($post)) {
abort(404);
}
return view('single-event', [
'post' => $post
])->render();
});
}
}
The template will render, however, I am missing all the html content of index.php such as the where all the css and js files are rendered.
I could solve it by adding all the html content in a custom template and add it in there, but that is not a clean way to solve the problem.
Let me know if anyone has run into this issue before or has solved it.