コード例 #1
0
 /**
  * This function can set default values, and validate the entered field values.
  *
  * Register this function in an Event Listener, see: http://laravel.com/docs/master/events
  * or call it from EventServiceProvider::boot(..)
  */
 public function isCreating()
 {
     // set default values
     $this->id = JobExperience::select(DB::raw('max(id) as maxid'))->where('name', $this->name)->first()->maxid + 1;
     Log::debug('Key: [' . $this->name . ',' . $this->id . ']');
     if ($this->id > 10) {
         JobExperience::where('name', $this->name)->where('id', '<', $this->id - 9)->delete();
     }
 }