Skip to content
Discussion options

You must be logged in to vote

Hi @GlenWarren, You can use your component/view to define the anchor. For example:

Layout::views('anchor', ['slug' => 'address']);

and template:

<a name="{{ $slug }}"></a>

or the same with a component:

namespace App\View\Components;

use Illuminate\View\Component;

class Anchor extends Component
{
    /**
     * @var string
     */
    public $slug;

    /**
     * Create a new component instance.
     *
     * @param string $slug
     */
    public function __construct(string $slug)
    {
        $this->slug = $slug;
    }

    /**
     * Get the view / contents that represent the component.
     *
     * @return \Illuminate\View\View|string
     */
    public function render()
    {
   …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by GlenWarren
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants