| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 | <?php/** * Created by PhpStorm. * User: tandunzhao * Date: 2017/12/6 * Time: 下午7:03 */namespace App\Modules\Finance\Models;use Illuminate\Database\Eloquent\Model;class Bank extends Model{    protected $table = 'banks';    protected $fillable = ['name','code', 'source', 'is_show'];    /**     * @param $id     * @return mixed     */    public static function getBankSingle($id) {        return self::find($id);    }    /**     * @param $name     * @param $source     * @return mixed     */    public static function getBankSingleByNameSource($name, $source) {        $search_object = self::where('name', $name)->where('source', $source);        return $search_object->first();    }    /**     * 获取银行列表     * @param string $source     * @return mixed     */    public static function getBankList($source = '') {        $search_object = self::orderBy('id','asc')->where('is_show', 1);        if($source) {            $search_object->where('source', $source);        }        return $search_object->get();    }}
 |