$this->validate($request, [
'uploaded_to' => 'required|integer|exists:pages,id',
'name' => 'required|string|min:1|max:255',
- 'link' => 'url|min:1|max:255'
+ 'link' => 'string|min:1|max:255'
]);
$pageId = $request->get('uploaded_to');
$this->validate($request, [
'uploaded_to' => 'required|integer|exists:pages,id',
'name' => 'required|string|min:1|max:255',
- 'link' => 'required|url|min:1|max:255'
+ 'link' => 'required|string|min:1|max:255'
]);
$pageId = $request->get('uploaded_to');
* @param $attachmentId
* @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Symfony\Component\HttpFoundation\Response
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
+ * @throws NotFoundException
*/
public function get($attachmentId)
{
},
getFileUrl(file) {
+ if (file.external && file.path.indexOf('http') !== 0) {
+ return file.path;
+ }
return window.baseUrl(`/attachments/${file.id}`);
},
},
checkValidationErrors(groupName, err) {
- console.error(err);
- if (typeof err.response.data === "undefined" && typeof err.response.data.validation === "undefined") return;
- this.errors[groupName] = err.response.data.validation;
- console.log(this.errors[groupName]);
+ if (typeof err.response.data === "undefined" && typeof err.response.data === "undefined") return;
+ this.errors[groupName] = err.response.data;
},
getUploadUrl(file) {
attachNewLink(file) {
file.uploaded_to = this.pageId;
+ this.errors.link = {};
this.$http.post(window.baseUrl('/attachments/link'), file).then(resp => {
this.files.push(resp.data);
this.file = this.newFile();