Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
search method
public function search(Request $request, WidgetChart $chart)
$this->validate($request, [
'widget_name' => 'required|alpha_num|max:20',
$searchterm = $request->widget_name;
$widgets = DB::table('widgets');
$results = $widgets->where('widget_name', 'LIKE', '%'. $searchterm .'%')
if (count($results) > 0){
$count = count($results);
$chartData = $chart->chartDataFrom($searchterm);
return view('widget.resultsindex', compact('results', 'count', 'chartData'));
return Redirect::route('widget.index')->with('message', ['Sorry, no results!']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.