whereNull('base_unit_id'); } $units = $query->select(DB::raw('CONCAT(actual_name, " (", short_name, ")") as name'), 'id')->get(); $dropdown = $units->pluck('name', 'id'); if ($show_none) { $dropdown->prepend(__('messages.please_select'), ''); } return $dropdown; } public function sub_units() { return $this->hasMany(\App\Unit::class, 'base_unit_id'); } public function base_unit() { return $this->belongsTo(\App\Unit::class, 'base_unit_id'); } }