mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-06 01:49:13 +00:00
109 - Autopublishing New Concerts
This commit is contained in:
@@ -20,6 +20,16 @@ class Concert extends Model
|
||||
return $query->whereNotNull('published_at');
|
||||
}
|
||||
|
||||
public function isPublished()
|
||||
{
|
||||
return $this->published_at !== null;
|
||||
}
|
||||
|
||||
public function publish()
|
||||
{
|
||||
$this->update(['published_at' => $this->freshTimestamp()]);
|
||||
}
|
||||
|
||||
public function getFormattedDateAttribute()
|
||||
{
|
||||
return $this->date->format('F j, Y');
|
||||
|
||||
@@ -46,6 +46,8 @@ class ConcertsController extends Controller
|
||||
'ticket_price' => request('ticket_price') * 100,
|
||||
])->addTickets(request('ticket_quantity'));
|
||||
|
||||
$concert->publish();
|
||||
|
||||
return redirect()->route('concerts.show', $concert);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user