Current project in LARAVEL get this error:
BadMethodCallException Method eloquent does not exist.
my routes.php:
Route::any('act', array('as' => 'ApiActividadesController', 'uses' => 'ApiActividadesController@get_index'));
my model.php (Actividades.php)
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;
class Actividades extends Eloquent implements UserInterface, RemindableInterface {
use UserTrait, RemindableTrait;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'actividades';
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = array('password', 'remember_token');
}
and my controller.php (ApiActividadesController.php)
class ApiActividadesController extends BaseController {
public $restful = true;
public function get_index($id = null)
{
if (is_null($id ))
{
return Response::eloquent(Actividades::all());
}
else
{
$actividades = Actividades::find($id);
if(is_null($actividades)){
return Response::json('Actividades not found', 404);
} else {
return Response::eloquent($actividades);
}
}
}
The error throws in the return Response::eloquent(Actividades::all());
I've try to rebuild entire project, use case sensitive but method "laravel" doesn't seems to apear.
need help!
Response::eloquent()what are you trying to do? - lukasgeiterResponse::json(Actividades::all())? - lukasgeiter