lundi 6 février 2017

Laravel Eloquent Basic Query Issue

Hellow everybody, I am facing a problem with laravel eloquent, if some one can help me wtih this prolem, it will be very good.

I am trying to get data from database in laravel. According to document I tried use code below to get all rows in "menulist" table but I get an error which I couldn't understand since I am new at laravel.

App\Model\ConfigMenulist.php
namespace App\Model\Config;

use Illuminate\Database\Eloquent\Model;

class Menulist extends Model
{

/**
 * The table associated with the model.
 *
 * @var string
 */
protected $table = "menulist";

/*
 * Set increment column name
 *
 * @var string
 */
protected $primaryKey = "menuId";

/**
 * Indicates if the model should be timestamped.
 *
 * @var bool
 */
public $timestamps = false;

// MASS ASSIGNMENT -------------------------------------------------------
// define which attributes are mass assignable (for security)
// we only want these 1 attributes able to be filled
protected $fillable = array('menuTitle');

}

AppController.php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Model\Config\Menulist;

class AppController extends Controller
{

public function index()
{
    $menu = Menulist::all();

    return view('app');
}

}

The error I got: enter image description here



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lfysWi
via IFTTT

Aucun commentaire:

Enregistrer un commentaire