mirror of
https://github.com/10h30/Test-Laravel-File-Upload.git
synced 2026-07-11 18:56:13 +09:00
Last tasks
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Company;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CompanyController extends Controller
|
||||
{
|
||||
public function store(Request $request)
|
||||
{
|
||||
$company = Company::create([
|
||||
'name' => $request->name,
|
||||
]);
|
||||
$company->addMediaFromRequest('photo')->toMediaCollection('companies');
|
||||
|
||||
return 'Success';
|
||||
}
|
||||
|
||||
public function show(Company $company)
|
||||
{
|
||||
// TASK: retrieve the full URL to the uploaded photo file, using Spatie Media Library
|
||||
$photo = '???';
|
||||
|
||||
return view('companies.show', compact('company', 'photo'));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user