2021-12-05 13:20:12 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
|
|
use App\Models\Project;
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
|
|
class ProjectController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function store(Request $request)
|
|
|
|
|
{
|
2021-12-05 13:44:24 +02:00
|
|
|
$request->validate([
|
|
|
|
|
// TASK: Write the validation rule so "logo" file would be MAX 1 megabyte
|
|
|
|
|
]);
|
|
|
|
|
|
2021-12-05 13:20:12 +02:00
|
|
|
// TASK: change the below line so that $filename would contain only filename
|
|
|
|
|
// The same filename as the original uploaded file
|
|
|
|
|
$filename = '???';
|
|
|
|
|
$request->file('logo')->storeAs('logos', $filename);
|
|
|
|
|
|
|
|
|
|
Project::create([
|
|
|
|
|
'name' => $request->name,
|
|
|
|
|
'logo' => $filename,
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
return 'Success';
|
|
|
|
|
}
|
|
|
|
|
}
|