|
|
@@ -6,7 +6,7 @@ use Livewire\Component;
|
|
|
|
|
|
class CourseSubscription extends Component
|
|
|
{
|
|
|
- public $records, $name, $months, $enabled, $dataId, $update = false, $add = false;
|
|
|
+ public $records, $name, $months, $month_day, $when_start, $enabled, $dataId, $update = false, $add = false;
|
|
|
|
|
|
protected $rules = [
|
|
|
'name' => 'required'
|
|
|
@@ -34,6 +34,8 @@ class CourseSubscription extends Component
|
|
|
public function resetFields(){
|
|
|
$this->name = '';
|
|
|
$this->months = 0;
|
|
|
+ $this->month_day = 0;
|
|
|
+ $this->when_start = '';
|
|
|
$this->enabled = true;
|
|
|
$this->emit('load-data-table');
|
|
|
}
|
|
|
@@ -58,6 +60,8 @@ class CourseSubscription extends Component
|
|
|
\App\Models\CourseSubscription::create([
|
|
|
'name' => $this->name,
|
|
|
'months' => $this->months,
|
|
|
+ 'month_day' => $this->month_day,
|
|
|
+ 'when_start' => $this->when_start,
|
|
|
'enabled' => $this->enabled
|
|
|
]);
|
|
|
session()->flash('success','Dato creato');
|
|
|
@@ -76,6 +80,8 @@ class CourseSubscription extends Component
|
|
|
} else {
|
|
|
$this->name = $course_subscription->name;
|
|
|
$this->months = $course_subscription->months;
|
|
|
+ $this->month_day = $course_subscription->month_day;
|
|
|
+ $this->when_start = $course_subscription->when_start;
|
|
|
$this->enabled = $course_subscription->enabled;
|
|
|
$this->dataId = $course_subscription->id;
|
|
|
$this->update = true;
|
|
|
@@ -93,6 +99,8 @@ class CourseSubscription extends Component
|
|
|
\App\Models\CourseSubscription::whereId($this->dataId)->update([
|
|
|
'name' => $this->name,
|
|
|
'months' => $this->months,
|
|
|
+ 'month_day' => $this->month_day,
|
|
|
+ 'when_start' => $this->when_start,
|
|
|
'enabled' => $this->enabled
|
|
|
]);
|
|
|
session()->flash('success','Dato aggiornato');
|