Compact recordings list rows to title plus one transcript preview line.
This commit is contained in:
@@ -179,6 +179,28 @@ class Recording extends Model
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* First line of the transcript, truncated for compact list rows.
|
||||
*/
|
||||
public function transcriptFirstLine(int $limit = 120): ?string
|
||||
{
|
||||
if (! filled($this->transcript)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$firstLine = Str::of($this->transcript)
|
||||
->before("\n")
|
||||
->replaceMatches('/\s+/', ' ')
|
||||
->trim()
|
||||
->toString();
|
||||
|
||||
if ($firstLine === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Str::limit($firstLine, $limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Short transcript excerpt, optionally centered on a search hit.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user