Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

393
Views
Can we store value of @yield in a variable

I have a simple question can we store the value that will be yielded in a variable.

for instance an example

$var = @yield('title')

If no, then is there any way to get the value of this yield

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Yes you can retrieve the value of an yield which is defined by a section using something like the following, for example:

// Assumed you've the following in your view: @section('title', 'Some Title')

$title = app()->view->getSections()['title']; // Some Title

Basically, the app()->view->getSections() will return you an associative array of all the sections so, to get a specific section, all you need to get an specific index from the array. From the view, you can access the app using the global $app variable, i.e: $app->view or $app['view'].

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!