Example #1
0
 public function solution_checkbox(Lead $lead = null)
 {
     $selected = [];
     if ($lead != null) {
         $selected = $lead->solutions()->orderBy('sort_order')->lists('solution_id');
     }
     if (request()->isMethod('post')) {
         if (request()->has('solutions')) {
             $selected = request()->get('solutions');
         }
     }
     $solutions = $this->all();
     $html = '';
     foreach ($solutions as $solution) {
         $html .= '<div class="checkbox">';
         $html .= form()->checkbox('solutions[]', $solution->id, in_array($solution->id, $selected), ['id' => 'cb_' . $solution->id]);
         $html .= form()->label('cb_' . $solution->id, $solution->name);
         $html .= '</div>';
     }
     return $html;
 }