DocumentController:
$document = new Document();
$input = Input::all();
$document->first_name = Auth::user()->first_name;
$document->last_name = Auth::user()->last_name;
$document->document = $input['title'];
$document->document = $input['body'];
$document->save();
$parent = new Parent();
$parent->title = $input['title'];
$parent->save();
父模型
class Parent extends \Eloquent {
}
第一个save()
实例工作正常,但另一个实例正在抛出错误方法[save]不存在。
文档模型
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;
class Document extends Eloquent implements UserInterface, RemindableInterface {
use UserTrait, RemindableTrait;
}
更新了父模型
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;
class Parent extends Eloquent implements UserInterface, RemindableInterface {
use UserTrait, RemindableTrait;
}