Upload beautify
This commit is contained in:
@@ -3,8 +3,9 @@
|
||||
namespace App\Http\Controllers\Dashboard;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Dashboard\ArtworkEditRequest;
|
||||
use App\Http\Requests\Dashboard\ArtworkDestroyRequest;
|
||||
use App\Http\Requests\Dashboard\UpdateArtworkRequest;
|
||||
use App\Models\Artwork;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
@@ -25,10 +26,9 @@ class ArtworkController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function edit(Request $request, int $id): View
|
||||
public function edit(ArtworkEditRequest $request, int $id): View
|
||||
{
|
||||
$artwork = $request->user()->artworks()->whereKey($id)->firstOrFail();
|
||||
$this->authorize('update', $artwork);
|
||||
$artwork = $request->artwork();
|
||||
|
||||
return view('artworks.edit', [
|
||||
'artwork' => $artwork,
|
||||
@@ -38,8 +38,7 @@ class ArtworkController extends Controller
|
||||
|
||||
public function update(UpdateArtworkRequest $request, int $id): RedirectResponse
|
||||
{
|
||||
$artwork = $request->user()->artworks()->whereKey($id)->firstOrFail();
|
||||
$this->authorize('update', $artwork);
|
||||
$artwork = $request->artwork();
|
||||
|
||||
$data = $request->validated();
|
||||
|
||||
@@ -83,10 +82,9 @@ class ArtworkController extends Controller
|
||||
->with('status', 'Artwork updated.');
|
||||
}
|
||||
|
||||
public function destroy(Request $request, int $id): RedirectResponse
|
||||
public function destroy(ArtworkDestroyRequest $request, int $id): RedirectResponse
|
||||
{
|
||||
$artwork = $request->user()->artworks()->whereKey($id)->firstOrFail();
|
||||
$this->authorize('delete', $artwork);
|
||||
$artwork = $request->artwork();
|
||||
|
||||
// Best-effort remove stored file.
|
||||
if (! empty($artwork->file_path) && Storage::disk('public')->exists($artwork->file_path)) {
|
||||
|
||||
Reference in New Issue
Block a user