app/Http/Controllers/MobileController.php
// public function deviceadd(Request $request) {
public function deviceadd(Request $request) {
public function deviceadd ( Request $request ) {
public function device_add($device_id) {
        if ($device_id) {
            $user = Auth::user();
            $devices = DB::table('devices')
                ->whereRaw('user_id = ? and device_id = ?', [$user->id, $device_id])
                ->get();
            if ($devices->count() == 0) {
                $device = new Device;
                $device->user_id = $user->id;
                $device->device_id = $device_id;
                $device->save();
            } else {
            }
        }
    }
public function device_add ( $ device_id ) { if ( $ device_id ) { $ user = Auth :: user ( ) ; $ devices = DB :: table ( 'devices' ) -> whereRaw ( 'user_id = ? and device_id = ?' , [ $ user -> id , $ device_id ] ) -> get ( ) ; if ( $ devices -> count ( ) == 0 ) { $ device = new Device ; $ device -> user_id = $ user -> id ; $ device -> device_id = $ device_id ; $ device -> save ( ) ; } else { } } }
public function deviceadd(Request $request) {
public function deviceadd ( Request $request ) {
// ->where([ // NG //         ['user_id', '==', $user->id], //         ['device_id', '==', $device_id], // ]) // $device->os = $request->os;         // 系统类型 (ios) // $device->ver = $request->ver;       // 系统版本 (9.2.1) // $device->name = $request->name;     // 设备名称 (KK) // $device->model = $request->model;   // 设备型号 (iPhone 4S) // $device->push_id = $push_id;