media list processing fix and all public lists page
This commit is contained in:
@@ -14,6 +14,17 @@ use Illuminate\Support\Str;
|
||||
|
||||
class MediaListController extends Controller
|
||||
{
|
||||
public function publicLists()
|
||||
{
|
||||
$lists = MediaList::with('user')
|
||||
->whereNotIn('name', MediaList::SPECIAL_LISTS)
|
||||
->where('public', true)
|
||||
->orderBy('created_at', 'desc')
|
||||
->paginate(20);
|
||||
|
||||
return view('lists.public', compact('lists'));
|
||||
}
|
||||
|
||||
public function index(string $slug)
|
||||
{
|
||||
$lists = MediaList::whereNotIn('name', MediaList::SPECIAL_LISTS)
|
||||
@@ -50,6 +61,7 @@ class MediaListController extends Controller
|
||||
'name' => $request->get('name'),
|
||||
'slug' => $slug,
|
||||
'user_id' => Auth::user()->id,
|
||||
'public' => $request->has('public') ? true : false,
|
||||
]);
|
||||
|
||||
return redirect()->route('profile.list.show', [Auth::user()->slug, $slug]);
|
||||
|
||||
@@ -30,5 +30,11 @@ class MediaList extends Model
|
||||
'slug',
|
||||
'poster_path',
|
||||
'user_id',
|
||||
'public',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -515,6 +515,7 @@ class MovieProcessingService implements ProcessingInterface
|
||||
unset($tmdbList['id']);
|
||||
|
||||
if (!$list) {
|
||||
$tmdbList['slug'] = Str::slug($tmdbList['name']);
|
||||
$list = MediaList::create($tmdbList);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user