2023-06-21 09:53:21 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use App\Models\Artist;
|
2023-12-14 12:30:49 -05:00
|
|
|
use App\Models\Artwork;
|
|
|
|
use App\Models\Podcast;
|
|
|
|
use App\Models\Episode;
|
2023-06-21 09:53:21 -04:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
class ArtistController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Display a listing of the resource.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function index()
|
|
|
|
{
|
2023-12-14 12:30:49 -05:00
|
|
|
$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,
|
|
|
|
]);
|
2023-06-21 09:53:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show the form for creating a new resource.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function create()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Store a newly created resource in storage.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function store(Request $request)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display the specified resource.
|
|
|
|
*
|
|
|
|
* @param \App\Models\Artist $artist
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
2023-12-14 12:30:49 -05:00
|
|
|
public function show(Request $request, $slug)
|
2023-06-21 09:53:21 -04:00
|
|
|
{
|
2023-12-14 12:30:49 -05:00
|
|
|
$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,
|
|
|
|
]);
|
2023-06-21 09:53:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show the form for editing the specified resource.
|
|
|
|
*
|
|
|
|
* @param \App\Models\Artist $artist
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function edit(Artist $artist)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the specified resource in storage.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @param \App\Models\Artist $artist
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function update(Request $request, Artist $artist)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove the specified resource from storage.
|
|
|
|
*
|
|
|
|
* @param \App\Models\Artist $artist
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function destroy(Artist $artist)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
}
|