你能帮我吗?
我刚刚开始使用laravel 5并且无法获得这个简单的模型:all()可以工作.我确定我做错了什么,但我找不到什么.
这就是我所拥有的:
routes.php文件
Route::get('/', 'PageController@index');
Run Code Online (Sandbox Code Playgroud)
Partner.php
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class Partner extends Model {
protected $table = 'tab_parceiro';
protected $fillable = '';
public $timestamps = false;
protected $primaryKey = 'codigo';
}
Run Code Online (Sandbox Code Playgroud)
PageController.php
<?php namespace App\Http\Controllers;
class PageController extends Controller {
public function __construct()
{
}
public function index()
{
$partners = \App\Partner::all();
//return view('index', compact('partners'));
}
}
Run Code Online (Sandbox Code Playgroud)
错误:
[2015-03-14 12:50:22] production.ERROR: exception 'ErrorException' with message 'array_flip() expects parameter 1 to be array, string given' in /home/ubuntu/workspace/storage/framework/compiled.php:9360 …Run Code Online (Sandbox Code Playgroud)