progress
This commit is contained in:
@@ -34,7 +34,7 @@ class MediaListController extends Controller
|
||||
return view('profile.lists.show', compact('list', 'items', 'user'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
public function create(string $userSlug)
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
|
||||
@@ -4,8 +4,10 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\Movie\CommentRequest;
|
||||
use App\Models\Comment;
|
||||
use App\Models\MediaList;
|
||||
use App\Models\Movie;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class MovieController extends Controller
|
||||
{
|
||||
@@ -26,7 +28,14 @@ class MovieController extends Controller
|
||||
->where('entity_type', Comment::TYPE_MOVIE)
|
||||
->paginate(15);
|
||||
|
||||
return view('movie.show', compact('movie', 'comments'));
|
||||
$userLists = [];
|
||||
if (Auth::check()) {
|
||||
$userLists = MediaList::whereNotIn('name', MediaList::SPECIAL_LISTS)
|
||||
->where('user_id', Auth::user()->id)
|
||||
->get();
|
||||
}
|
||||
|
||||
return view('movie.show', compact('movie', 'comments', 'userLists'));
|
||||
}
|
||||
|
||||
public function storeComment(CommentRequest $request, string $movieSlug)
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Movie;
|
||||
use App\Models\Person;
|
||||
use App\Models\Show;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SearchController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$query = $request->input('query');
|
||||
$type = $request->input('type', 'all');
|
||||
|
||||
$movies = collect([]);
|
||||
$shows = collect([]);
|
||||
$people = collect([]);
|
||||
|
||||
if ($query) {
|
||||
// Search for movies if type is 'all' or 'movie'
|
||||
if ($type === 'all' || $type === 'movie') {
|
||||
$movies = Movie::where('title', 'like', "%{$query}%")
|
||||
->orWhere('overview', 'like', "%{$query}%")
|
||||
->limit(20)
|
||||
->get();
|
||||
}
|
||||
|
||||
// Search for TV shows if type is 'all' or 'tv'
|
||||
if ($type === 'all' || $type === 'tv') {
|
||||
$shows = Show::where('name', 'like', "%{$query}%")
|
||||
->orWhere('overview', 'like', "%{$query}%")
|
||||
->limit(20)
|
||||
->get();
|
||||
}
|
||||
|
||||
// Search for people if type is 'all' or 'person'
|
||||
if ($type === 'all' || $type === 'person') {
|
||||
$people = Person::where('name', 'like', "%{$query}%")
|
||||
->limit(20)
|
||||
->get();
|
||||
}
|
||||
}
|
||||
|
||||
return view('search.results', [
|
||||
'query' => $query,
|
||||
'type' => $type,
|
||||
'movies' => $movies,
|
||||
'shows' => $shows,
|
||||
'people' => $people,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user