V
V
vvmgev2015-08-11 12:06:59
Laravel
vvmgev, 2015-08-11 12:06:59

Method [all] does not exist?

controller

class Asa extends Controller {

  public function index()
  {
    $model  = Asаa::all();
    return View('asa');
  }

model
<?php namespace App;

use Illuminate\Database\Eloquent\Model;

class Asaа extends Model {

}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
tplus, 2015-08-11
@tplus

Probably a typo: Asa - Asaa.
Or, after all, the all method in Asaa is really not defined.
$model = Asаa::all();

P
pesenka1, 2015-08-11
@pesenka1

class User extends Model {}

class User extends Model {

    protected $table = 'my_users';

}

RTFM

E
ellrion, 2015-08-11
@ellrion

There is a suspicion that you provided a code different from what you actually have, firstly. And you have the model and controller named the same there. And when you call all() on a class, it is the controller class that is taken. Whatever it is, or name them differently. Or specify the full name for the model (including the entire namespace). Well, or export the model with an alias

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question