Update (post): only show table of contents if there are at least 3 toc items

This commit is contained in:
2023-09-25 19:54:51 +08:00
parent 8faf131f13
commit e3fe8bf877
8 changed files with 82 additions and 94 deletions

View File

@@ -33,27 +33,24 @@
Route::get('/step-2', function (Request $request) {
$news_serp_result = NewsSerpResult::find($request->input('id', null));
if (is_null($news_serp_result))
{
abort(404);
if (is_null($news_serp_result)) {
abort(404);
}
$task = ParseNewsSerpDomainsTask::handle($news_serp_result);
if ($task)
{
$serp_url = SerpUrl::latest()->first();
if ($task) {
$serp_url = SerpUrl::latest()->first();
dd($serp_url->id);
dd($serp_url->id);
}
});
Route::get('/step-3', function (Request $request) {
$serp_url = SerpUrl::find($request->input('id', null));
if (is_null($serp_url))
{
abort(404);
if (is_null($serp_url)) {
abort(404);
}
$task = GenerateArticleJob::dispatch($serp_url)->onQueue('default')->onConnection('default');
@@ -70,18 +67,16 @@
});
Route::get('/step-5', function (Request $request) {
$post = Post::find($request->input('id'));
$post = Post::find($request->input('id'));
if (is_null($post))
{
return abort(404);
}
if (is_null($post)) {
return abort(404);
}
$post->published_at = now();
dd($post->save());
$post->published_at = now();
dd($post->save());
});
// Route::get('/suggest_titles', function () {
// $results = OpenAI::suggestArticleTitles("It's 2019s Electric: How Fisker Is Reinventing The Automotive Industry And \nExpanding Its Business", "Fisker's approach to building electric vehicles is deeply intertwined with \nits overall business philosophy: use less, use better,...s", 1);
// dd($results);
@@ -92,14 +87,12 @@
// dd($results);
// });
Route::get('proxy_test', function () {
$url = 'https://www.cnbc.com/2023/09/24/this-southern-city-is-the-no-1-place-to-start-your-own-business.html';
$task = ScrapeUrlBodyTask::handle($url);
Route::get('proxy_test', function() {
$url = 'https://www.cnbc.com/2023/09/24/this-southern-city-is-the-no-1-place-to-start-your-own-business.html';
$task = ScrapeUrlBodyTask::handle($url);
dd($task);
dd($task);
});
// Route::get('/image_gen', function() {