<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class SearchModel extends Model
{
    public function search($search){
        $search_arr = '';
        foreach($search as $row){
         if($row != ''){
          $search_arr .= $row.'AND';
         }
        }
        $search_str = trim($search_arr,"AND"); 
        $search_where = " WHERE $search_str ";
        $search_where = (empty($search_str))? '':$search_where;
        
        return $search_where;
    }

    public function search_lavarel($search){
        $search_arr = '';
        foreach($search as $row){
            if($row != ''){
                $search_arr .= $row;
            }
        }
        $search_where = (empty($search_arr))? '':$search_arr;
        
        return $search_where;
    }
}


