feat/factory_creation (#1)
Prepping for launch. Reviewed-on: #1 Co-authored-by: Paul Couture <paul@paulcouture.com> Co-committed-by: Paul Couture <paul@paulcouture.com>
This commit was merged in pull request #1.
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Artist;
|
||||
use App\Models\Artwork;
|
||||
use App\Models\Podcast;
|
||||
use App\Models\Episode;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ArtistController extends Controller
|
||||
@@ -14,7 +17,18 @@ class ArtistController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
$user = auth()->user();
|
||||
$artists = Artist::whereHas('artworks')
|
||||
->withCount('artworks')
|
||||
->orderBy('artworks_count', 'desc')
|
||||
->paginate(100);
|
||||
$podcasts = Podcast::where('published', true)->with('episodes')->get();
|
||||
return view('profile.artists', [
|
||||
'user' => $user,
|
||||
'pageTitle' => 'Artists',
|
||||
'podcasts' => $podcasts,
|
||||
'artists' => $artists,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,9 +58,23 @@ class ArtistController extends Controller
|
||||
* @param \App\Models\Artist $artist
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Artist $artist)
|
||||
public function show(Request $request, $slug)
|
||||
{
|
||||
//
|
||||
$user = auth()->user();
|
||||
$artist = Artist::where('slug', $slug)
|
||||
->firstOrFail();
|
||||
$artworks = Artwork::where('artist_id', $artist->id)
|
||||
->with('episode')
|
||||
->with('podcast')
|
||||
->orderBy('artworks.created_at', 'desc')
|
||||
->paginate($perPage = 92, $columns = ['*'], $pageName = 'artworks');
|
||||
$podcasts = Podcast::where('published', true)->with('episodes')->get();
|
||||
return view('profile.artist', [
|
||||
'user' => $user,
|
||||
'artist' => $artist,
|
||||
'artworks' => $artworks,
|
||||
'podcasts' => $podcasts,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user