use DatabaseTransactions;
protected $admin;
+ protected $editor;
/**
* Set the current user context to be an admin.
return $this->admin;
}
+ /**
+ * Set the current user context to be an editor.
+ * @return $this
+ */
+ public function asEditor()
+ {
+ return $this->actingAs($this->getEditor());
+ }
+
+
+ /**
+ * Get a editor user.
+ * @return mixed
+ */
+ public function getEditor() {
+ if($this->editor === null) {
+ $editorRole = Role::getRole('editor');
+ $this->editor = $editorRole->users->first();
+ }
+ return $this->editor;
+ }
+
/**
* Create and return a new book.
* @param array $input