0
私はララベルの雄弁の問題に直面しています。もしこのプロンプトに役立つ人がいれば、それはとても良いでしょう。Laravel Eloquent基本的な質問の問題
私はlaravelのデータベースからデータを取得しようとしています。ドキュメントによると、私は "menulist"テーブルのすべての行を取得するために以下のコードを使用しようとしましたが、私は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');
}
}
エラーメッセージを読んだことがありますか?それはlaravelやあなたのコードとは関係ありません。それは、必要に応じてより複雑になると、すべてがうまく見えます。 127.0.0.1(ループバック)でmysqlを実行していません。データベースの設定が間違っていたり、存在していない可能性があります。 –