app/Http/Controllers/AndroidController.php
//Kur 0 indexe email ir api tokenas
Kur 0 indexe email ir api tokenas
Kur 0 indexe email ir api tokenas
public function postGrafikas(Request $request)
    {
        $array = $request->all();
        $user = User::where('email', $array[0]["email"])->first();
        if (Hash::check($array[0]["api_token"], $user->api_token)) {
            $graphs = Graph::where('user_id', $user->id)->where('statusas', 'laisva');
            if($graphs->get()->isNotEmpty())
            {
                $graphs->delete();
            }
            unset($array[0]);
            Graph::insert($array); 
            return ["success"];
        }
        return ["no"];
    }
public function postGrafikas ( Request $ request ) { $ array = $ request -> all ( ) ; $ user = User :: where ( 'email' , $ array [ 0 ] [ " email " ] ) -> first ( ) ; if ( Hash :: check ( $ array [ 0 ] [ " api_token " ] , $ user -> api_token ) ) { $ graphs = Graph :: where ( 'user_id' , $ user -> id ) -> where ( 'statusas' , 'laisva' ) ; if ( $ graphs -> get ( ) -> isNotEmpty ( ) ) { $ graphs -> delete ( ) ; } unset ( $ array [ 0 ] ) ; Graph :: insert ( $ array ) ; return [ " success " ] ; } return [ " no " ] ; }
Kur 0 indexe email ir api tokenas
Kur 0 indexe email ir api tokenas
//Istrinam email ir Api array dali //return [$array[1]]; //Bulk Save