addButtonFromModelFunction return `Undefined variable: entry`
See original GitHub issueWhen 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:
- Created 6 years ago
- Reactions:1
- Comments:9 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Then maybe the template should be updated?
https://github.com/Laravel-Backpack/CRUD/blob/master/src/resources/views/inc/button_stack.blade.php
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: