public function run() { $user = User::where('username', 'paul')->first(); Note::create(['body' => 'First note', 'user_id' => $user->id]); Note::create(['body' => 'Second note', 'user_id' => $user->id]); $user = User::where('username', 'john')->first(); Note::create(['body' => 'Third note', 'user_id' => $user->id]); Note::create(['body' => 'Fourth note', 'user_id' => $user->id]); }
/** * Add a new note to the current user * * @param array request input * * @return App\Model\Note */ public function create($input) { $user = $this->container->get('currentUser'); return Note::create(['body' => $input['body'], 'user_id' => $user->userId]); }