mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 11:14:06 +00:00
142 - Optional Files and the Null Object Pattern
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Backstage;
|
||||
|
||||
use App\Concert;
|
||||
use App\NullFile;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rule;
|
||||
@@ -55,7 +56,7 @@ class ConcertsController extends Controller
|
||||
'zip' => request('zip'),
|
||||
'ticket_price' => request('ticket_price') * 100,
|
||||
'ticket_quantity' => (int) request('ticket_quantity'),
|
||||
'poster_image_path' => request('poster_image')->store('posters', 's3'),
|
||||
'poster_image_path' => request('poster_image', new NullFile)->store('posters', 's3'),
|
||||
]);
|
||||
|
||||
return redirect()->route('backstage.concerts.index');
|
||||
|
||||
11
app/NullFile.php
Normal file
11
app/NullFile.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
class NullFile
|
||||
{
|
||||
public function store()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user