public static function map($file_id, $params) { $dm = new DocumentMapping(); $dm->owner_id = $params["owner_id"]; $dm->owner_type = $params["owner_type"]; $dm->file_id = $file_id; $dm->document_type = $params["proof_type"]; var_dump($params); die; $dm->save(); }
public function photo_document() { $md_id = Masterdata::getId("OFPHO", "document_type"); $document_mapping = DocumentMapping::where('owner_type', '=', 'new_customer')->where('owner_id', '=', $this->id)->get(); if (count($document_mapping) != 0) { foreach ($document_mapping as $dm) { if ($dm->document->document_id == $md_id) { return $dm->document; } } } return false; }