Hi, I'm learning laravel recently I'm experiencing a problem It seems that the eloquent method inherits the right legacy. Not found in When I tried to get all the data from one table in my controller index method, it calls the "undefined method category :: all ()" .. It's something disturbing that I had never done before as I The code did the same way. I pasted my code below, pls need to ur attention.
Model:
& lt ;? Php class category is extended \ eloquent {// protected $ fillable = []; Protected $ table = 'categories'; Public static function getCategory ($ category) {$ category- & gt; Category = $ range ['category']; $ Range & gt; Save (); }}
Controller:
Public function index () {// get all inputs $ categories = category :: all (); // Load the view and return the input View: create ('Management category') - & gt; With ('categories', $ ranges); }
View:
& lt; Div class = "col-md-4" & gt; & Lt; Select name = 'category' class = "table-group-action-input form-control" name = "product [status]" & gt; & Lt; Options & gt; Select & lt; / Options & gt; @if (isset ($ categories)) @foreach (categories as categories) & lt; Option value = "{{$ categories-& gt; id}}" & gt; {{$ Categories- & gt; Category}} & lt; / Options & gt; @adornach @ atif & lt; / Select & gt; & Lt; / Div & gt;
route:
Root :: find ('/ management-category', 'category controller @ index');