Update
This commit is contained in:
@@ -152,7 +152,6 @@ public static function generateMemeByKeyword($keyword)
|
||||
return $meme;
|
||||
}
|
||||
|
||||
|
||||
public static function generateMemeOutputByKeyword($keyword, $category = null)
|
||||
{
|
||||
|
||||
@@ -203,7 +202,7 @@ public static function generateMemeOutputByKeyword($keyword, $category = null)
|
||||
$meme_output = (object) [
|
||||
'success' => false,
|
||||
'attempts' => $attempt, // Optional: track how many attempts were made
|
||||
'error' => 'Failed to generate valid meme after ' . $retries . ' attempts',
|
||||
'error' => 'Failed to generate valid meme after '.$retries.' attempts',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -216,13 +215,13 @@ public static function generateMemeOutputByCategory(Category $category)
|
||||
$random_keyword = Str::lower($category->name);
|
||||
|
||||
if (! is_null($category->parent_id)) {
|
||||
$random_keyword = $category->parent->name . ' - ' . $random_keyword;
|
||||
$random_keyword = $category->parent->name.' - '.$random_keyword;
|
||||
}
|
||||
|
||||
if (! is_null($category->meme_angles)) {
|
||||
$random_keyword .= ' - ' . collect($category->meme_angles)->random();
|
||||
$random_keyword .= ' - '.collect($category->meme_angles)->random();
|
||||
} elseif (! is_null($category->keywords)) {
|
||||
$random_keyword .= ' - ' . collect($category->keywords)->random();
|
||||
$random_keyword .= ' - '.collect($category->keywords)->random();
|
||||
}
|
||||
|
||||
return self::generateMemeOutputByKeyword($random_keyword, $category);
|
||||
|
||||
Reference in New Issue
Block a user