HomeController with blade view

Hey,

i try to use statamic with my own Controller and Blade as template engine and have problems to access my entry/blueprint data inside my view like i can do with antlers views.

How i can access/pass my home entry data $title $author $bard to my view like $foo?

What i have done:

Route::get('/', HomeController::class)

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class HomeController extends Controller
{
    public function __invoke()
    {
        $foo = 'bar';

        return view('home', compact('foo'));
    }
}

home.blade.php

@extends('layout')
@section('content')

<ul class="flex space-x-4">
    @nav('main')
      <li>
        <a href="{{ $item['url'] }}"@if($item['is_current'] || $item['is_parent']) class="current"@endif>
          {{ $item['title'] }}
        </a>
      </li>
    @endnav
</ul>

{{ $title }} <---- variable not defined!
{{ $author }} <---- variable not defined!
{{ $bard }} <---- variable not defined!

{{ $foo }} <---- returns bar

@endsection
>>>>>>> Unanswered <<<<<<<
3 Replies
2 Followers