lots of progress
This commit is contained in:
@@ -315,10 +315,25 @@ class MovieProcessingService implements ProcessingInterface
|
||||
->where('tmdb_id', $tmdbReview['id'])
|
||||
->first();
|
||||
|
||||
// @todo create user
|
||||
$user = User::where('name', $tmdbReview['author'])->first();
|
||||
|
||||
if (!$user) {
|
||||
$user = User::create([
|
||||
'name' => $tmdbReview['author'],
|
||||
'slug' => Str::slug($tmdbReview['author']),
|
||||
'email' => $tmdbReview['author'].'@nowhere.wtf',
|
||||
'password' => 'no_password_neeeded_here',
|
||||
'is_dummy_account' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
if (!$existingReview) {
|
||||
Comment::create([
|
||||
'entity_id' => $movie->id,
|
||||
'entity_type' => Comment::TYPE_MOVIE,
|
||||
'user_id' => $user->id,
|
||||
'author_name' => $tmdbReview['author'],
|
||||
'author_avatar' => $tmdbReview['author_details']['avatar_path'],
|
||||
'author_rating' => $tmdbReview['author_details']['rating'],
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class ToolService
|
||||
{
|
||||
public static function isCurrentRoute(
|
||||
string $routePath
|
||||
)
|
||||
{
|
||||
$currentPath = Route::getCurrentRequest()->path();
|
||||
$uri = ltrim(str_replace(env('APP_URL'), '', $routePath), '/');
|
||||
|
||||
return $currentPath == $uri;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user