/**
  * Search conrtractors
  *
  * @param Request $request
  * @return Response
  */
 public function search(Request $request)
 {
     $scopesText = array_map(function ($v) {
         return array_get($v, 'scope', '');
     }, Scopes::whereIn('id', $request->get('scopes', []))->get(['scope'])->toArray());
     $classificationsText = array_map(function ($v) {
         return array_get($v, 'classification', '');
     }, Classifications::whereIn('id', $request->get('classifications', []))->get(['classification'])->toArray());
     $jurisdictionsText = array_map(function ($v) {
         return array_get($v, 'jurisdiction', '');
     }, Jurisdictions::whereIn('id', $request->get('jurisdictions', []))->get(['jurisdiction'])->toArray());
     $input = ['name' => $request->get('name', ''), 'phone' => preg_replace('/[()-.\\s]/', '', $request->get('phone', '')), 'scopes' => $request->get('scopes', []), 'scopesText' => $scopesText, 'classifications' => $request->get('classifications', []), 'classificationsText' => $classificationsText, 'jurisdictions' => $request->get('jurisdictions', []), 'jurisdictionsText' => $jurisdictionsText];
     $request->session()->put('input', $input);
     return redirect()->route('contractor.search.result');
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('classifications')->truncate();
     Classifications::insert([['id' => 1, 'classification' => 'Commercial'], ['id' => 2, 'classification' => 'Residential'], ['id' => 3, 'classification' => 'Industrial'], ['id' => 4, 'classification' => 'Heavy & Highway'], ['id' => 5, 'classification' => 'Remodel'], ['id' => 6, 'classification' => 'Retrofit'], ['id' => 7, 'classification' => 'Tenant Improvement'], ['id' => 8, 'classification' => 'Weatherization'], ['id' => 9, 'classification' => 'Medical Facilities'], ['id' => 10, 'classification' => 'General Contractor'], ['id' => 11, 'classification' => 'Sub Contractor']]);
 }