/** * SHow document details */ public function show(Request $request, DocumentIndexRepository $documentIndexRepo, $id) { $data['document'] = $documentIndexRepo->find($id, ['id', 'title', 'owner', 'content', 'words']); $docUser = User::find($data['document']->owner); $data['ownerName'] = $docUser->name; return view('document.show', $data); }
/** * Execute the job. * * @return void */ public function handle(DocumentIndexRepository $documentIndexRepo) { $document = ['content' => $this->content, 'title' => $this->title, 'words' => str_word_count(strip_tags($this->content), 1)]; $documentIndexRepo->update($document, $this->id); }
/** * Search for word in documents */ public function search(Request $request, DocumentIndexRepository $documentIndexRepo) { $data['documents'] = $documentIndexRepo->paginateCriteria(10, 'words', $request->input('word'), ['id', 'title', 'owner']); $data['word'] = $request->input('word'); return view('search', $data); }
/** * Execute the job. * * @return void */ public function handle(DocumentIndexRepository $documentIndexRepo) { $document = ['content' => $this->content, 'owner' => Auth::user()->id, 'title' => $this->title, 'words' => str_word_count(strip_tags($this->content), 1)]; $documentIndexRepo->create($document); }