How to pick up specific item In the Laravel Blade

Asked

Viewed 107 times

0

How do I pick up a specific item on Laravel Blade?

Example:

$(document).ready(function(){
var id = 1;
    $('body').append('{{ $projeto->'+id+'->name}}'
})

<body>
   Deve Aparecer aqui o nome do projeto
</body>
  • 2

    You have to add a ) to the append

  • You do not have to access the Blade, you have to access the generated html ... what you need to access, what this Blade generates?

1 answer

0

I don’t know if I understand very well, but if you want to pass the name of the project that is configured in the file . Laravel’s ENV just use the helper:

{{ config('app.name', 'Laravel') }}

Enter this anywhere in your view

To configure the project name, go to the project root and open the file. ENV the first line will be "APP_NAME", if necessary change this line to what you want and automatically appear in your view.

Abc

Browser other questions tagged

You are not signed in. Login or sign up in order to post.