我已经为安装PredictionIO而奋斗了几个星期今天我遇到了一种新的"简单"方法来安装流浪者:https://www.sitepoint.com/predictionio-bootstrapping-a-movie-recommendation-app/
当我输入$ vagrant up
它给出了以下输出
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
==> default: Running provisioner: shell...
default: Running: /tmp/vagrant-shell20170925-16688-9a1tte.sh
==> default: PredictionIO already installed. Skip installation.
**==> **default: /tmp/vagrant-shell: line 32: pio-start-all: command not** found**
==> default: --------------------------------------------------------------------------------
==> default: …Run Code Online (Sandbox Code Playgroud) 我尝试按照此处的文档进行操作,但没有得到所需的结果,我的表格看起来像
用户表
id (pk - int) | username,
Run Code Online (Sandbox Code Playgroud)
推文表
id (pk - int) | user_id (fk - int) | tweet(varchar)
Run Code Online (Sandbox Code Playgroud)
用户模型
public function tweets() {
return $this->hasMany('App\Tweet', 'user_id); // user_id is FK
}
Run Code Online (Sandbox Code Playgroud)
推文模型
public function user() {
return $this->belongsTo('App\User');
}
Run Code Online (Sandbox Code Playgroud)
在控制器方面,我使用 eloquent 来检索数据。我有这个方法,
public function ajax($id) {
$data = User::with('tweets')->find($id)->tweets();
return $data;
}
Run Code Online (Sandbox Code Playgroud)
我尝试遵循此处的逻辑,但在控制器代码上收到以下错误:
试图获取非对象的属性