[ 'Romanah\Gokbakja\Models\PivotProduction', 'key' => 'production_id', 'softDelete' => true ], 'pivot_production_calculation' => [ 'Romanah\Gokbakja\Models\ProductionCalculate', 'key' => 'production_id', 'softDelete' => true ] ]; public $belongsTo = [ 'excruiter' => [ 'Romanah\Gokbakja\Models\Excruiter', 'key' => 'excruiter_id' ], 'shift' => [ 'Romanah\Gokbakja\Models\Shift', 'key' => 'shift_id' ] ]; public function scopeGetByGroup($query) { return $query->select('id', 'created_at', 'all_amount', 'note', DB::raw('count(id) as `data`'), DB::raw("DATE_FORMAT(created_at, '%d-%m-%Y') new_date"), DB::raw('YEAR(created_at) year, MONTH(created_at) month, DAY(created_at) day')) ->orderBy('id', 'DESC') ->groupby('year','month', 'day'); } /** * @var string The database table used by the model. */ public $table = 'romanah_gokbakja_production'; /** * @var array Validation rules */ public $rules = [ 'all_amount' => 'required', ]; public $customMessages = [ 'all_amount.required' => 'Jemi diýen hökman doldurylmalydyr.', ]; }