how to Automatically calculate expiry date in backpack laravel? -


i have field name month want when user set month automatic calculate created at month , upload database.

ps - sorry new @ laravel

please see edit:

my store method looks like

<?php  namespace app\http\controllers\admin;  use backpack\crud\app\http\controllers\crudcontroller;   // validation: change requests match own file names if need  form validation use app\http\requests\clientsrequest storerequest; use app\http\requests\clientsrequest updaterequest; use carbon\carbon;   class clientscrudcontroller extends crudcontroller { public function setup() {      $this->crud->setmodel('app\models\clients');     $this->crud->setroute(config('backpack.base.route_prefix') . '/clients');     $this->crud->setentitynamestrings('clients', 'clients');      $this->crud->setfromdb();  }  public function store(storerequest $request) {     // additional operations before save here       $start_day = carbon::parse($request->created_at);     $expiry_day = $start_day->addmonths($request->month);     $request->input($expiry_day);      $redirect_location = parent::storecrud($request);     // additional operations after save here     // use $this->data['entry'] or $this->crud->entry     return $redirect_location; }  public function update(updaterequest $request) {     // additional operations before save here     $redirect_location = parent::updatecrud($request);     // additional operations after save here     // use $this->data['entry'] or $this->crud->entry     return $redirect_location; } 

}

assuming mean months ammount ( i.e monthly payment )

you can in store method i.e:

$start_day = carbon::parse($request->created_at); //get carbon instance created_at date $expiry_day = $start_day->addmonths($request->user_selected_months); //add x months created_at date 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -