fix view to array for education and experience calon
This commit is contained in:
@@ -29,4 +29,39 @@ class Nominee extends Model
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getEducationAttribute($value)
|
||||
{
|
||||
$longString = $value;
|
||||
|
||||
// Regular expression pattern to match the delimiter followed by any character and a newline or end of string
|
||||
$pattern = "/\d+\.\s*(.+?)(?=\d+\.\s|$)/";
|
||||
|
||||
|
||||
// Tokenize the string into an array using preg_split
|
||||
$tokens = preg_split($pattern, $longString, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
// Clean up leading and trailing whitespace from each element
|
||||
$tokens = array_map('trim', $tokens);
|
||||
|
||||
return $tokens;
|
||||
}
|
||||
|
||||
public function getExperienceAttribute($value)
|
||||
{
|
||||
$longString = $value;
|
||||
|
||||
//newline
|
||||
// Regular expression pattern to match the delimiter followed by any character and a newline or end of string
|
||||
$pattern = "/\d+\.\s*(.+?)(?:\n|$)/";
|
||||
|
||||
|
||||
// Tokenize the string into an array using preg_split
|
||||
$tokens = preg_split($pattern, $longString, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
// Clean up leading and trailing whitespace from each element
|
||||
$tokens = array_map('trim', $tokens);
|
||||
|
||||
return $tokens;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,8 +93,15 @@
|
||||
<div class="detail-section">
|
||||
<span><b> Nama : </b>{{ nomineeViewed.name }}</span>
|
||||
<span><b> Unit : </b>{{ nomineeViewed.unit }}</span>
|
||||
<span><b> Taraf Pendidikan : </b>{{ nomineeViewed.education }}</span>
|
||||
<span><b> Pengalaman Kerja : </b>{{ nomineeViewed.experience }}</span>
|
||||
<span> <b>Taraf Pendidikan :</b> </span>
|
||||
<ol>
|
||||
<li v-for="(item, index) in nomineeViewed.education" :key="index">{{ item }}</li>
|
||||
</ol>
|
||||
|
||||
<span><b> Pengalaman Kerja : </b></span>
|
||||
<ol>
|
||||
<li v-for="(item, index) in nomineeViewed.experience" :key="index">{{ item }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user