question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

addButtonFromModelFunction return `Undefined variable: entry`

See original GitHub issue

When using:

$this->crud->addButtonFromModelFunction($stack, $name, $model_function_name, $position);

this error show:

Undefined variable: entry

the entry value is null and i think the problem coming from “button_stack.blade”:

{!! $entry->{$button->content}(); !!}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
victorlapcommented, Jun 6, 2017
3reactions
mdevocommented, Jun 5, 2017

Find the culprit. It is because the $entry value is null since the ‘top’ button stack don’t have any entry defined in list view. If I change the stack to ‘line’ it is work.

So, the :

{!! $entry->{$button->content}(); !!}

in “button_stack.blade” only work in ‘line’ stack ONLY.

Top or Bottom stack should work by modifying something like :

{!! $crud->model->{$button->content}(); !!}

Full:

	  @if ($button->type == 'model_function')
		@if ($stack == 'line')
	  		  {!! $entry->{$button->content}($entry); !!}
		@else		
			  {!! $crud->model->{$button->content}($crud); !!}
		@endif
	  @else
		@include($button->content)
	  @endif

Read more comments on GitHub >

github_iconTop Results From Across the Web

laravel backpack - Undefined variable $optionsForModels
What am i doing wrong? Models class Employee extends Model { public function numbers() { return $this->morphMany(PhoneNumber::class, 'numberable ...
Read more >
Undefined variable: data in view. - Laracasts
I'm creating a web site using a Laravel. Now I want to view all the data from the database called users. But, I...
Read more >
BackpackForLaravel/Lobby - Gitter
Hello, when I save a form in Backpack Laravel having a many-to-many entry field, is it possible to retrieve ids in the respective...
Read more >
Undefined variable: entry - Passing data from Controller to View
php): ``` public function showUpload(Entries $entry) { $entry = Entries::with('entrys')->where('user_id', '=', Auth::user()->id)->get(); return view('viewentry' ...
Read more >
Error Notice Undefined variable Notice Undefined index and ...
Notice: Undefined variable: my_variable_name in C:\wamp\www\niraj\index.php on line 18 Notice: ... The best way for getting input string is:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found