public function getImg(Guard $auth) { $postulante = Postulante::where('user_id', $auth->id())->first(); $docAdjunto = DocumentoAdjunto::where('postulante', $postulante->id)->where('path', 'like', 'testimonios%')->get(); $arrayFinal = []; foreach ($docAdjunto as $item) { # code... $arrayFinal[] = array('url' => '/documentos/' . $item->path, 'thumb' => '/documentos/' . $item->path, 'tag' => $item->nombre, 'id' => $item->id); } return json_encode($arrayFinal); }
public function getAllFiles(Guard $auth) { $postulante = Postulante::where('user_id', $auth->id())->first(); $documentos = DocumentoAdjunto::where('postulante', $postulante->id)->get(); return $documentos->toJson(); }