php artisan make:model User
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Request;
class mod_user extends Model
{
//
protected $table = "user";
public function getByid( $uid ){
$arrData = [];
$arrData = $this->where('id' , '=' , $uid )->first();
if( $arrData == null ){
return false;
}
return $arrData->toArray();
}
public function countByUser_str( $_user_str ){
$_user_str = trim($_user_str);
$iCount = $this->where('user_str' , $_user_str )->count();
return $iCount;
}
// public function
public function updateData( $aData ){
$aUpdateSet = [
'passwd_md5',
'momo' ,
'domain_data'
];
$aSave = cxdb_checkArray($aUpdateSet , $aData );
// dd($aSave);
$this->where('id' , $aData['id'] )
->update( $aSave );
}
public function deleteData( $_id ){
$this->where('id' , $_id )
->delete( );
}
}
...