/**
  * 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('scopes')->truncate();
     Scopes::insert([['id' => 1, 'scope' => 'TradeShow', 'craft' => 'TradeShow'], ['id' => 2, 'scope' => 'ShipWright', 'craft' => 'ShipWright'], ['id' => 3, 'scope' => 'Concrete - Horizontal Decks', 'craft' => 'Concrete'], ['id' => 4, 'scope' => 'Concrete - VerticalConcrete - Flatwork', 'craft' => 'Concrete'], ['id' => 5, 'scope' => 'Concrete - Tiltups', 'craft' => 'Concrete'], ['id' => 6, 'scope' => 'Acoustical', 'craft' => 'Interior Systems'], ['id' => 7, 'scope' => 'CleanRoom', 'craft' => 'Interior Systems'], ['id' => 8, 'scope' => 'Demountable Partitions & Furniture', 'craft' => 'Interior Systems'], ['id' => 9, 'scope' => 'Drywall', 'craft' => 'Interior Systems'], ['id' => 10, 'scope' => 'Firestopping & Expansion Joints', 'craft' => 'Interior Systems']]);
 }