Laravel-5.6-and-Vue.j-2-Dataviewer-Advanced-Filter icon indicating copy to clipboard operation
Laravel-5.6-and-Vue.j-2-Dataviewer-Advanced-Filter copied to clipboard

Enhancement

Open fabiohvp opened this issue 5 years ago • 0 comments

Allow pass the columns as parameter to avoid selecting *.

public function scopeAdvancedFilter($query, $columns = [])
{
	$result = $this->process($query, request()->all());

	if (count($columns) > 0) {
		$result = $result->select($columns);
	}

	return $result
		// ->orderBy(
		// 	request('order_column', 'created_at'),
		// 	request('order_direction', 'desc')
		// )
		->paginate(request('limit', 10));
}

Btw excellent job, thank you for sharing this

fabiohvp avatar Jun 10 '19 03:06 fabiohvp