Category : api

I create new own command in laravel, which updates some rows in mysql (in this case minecraft servers): public function handle() { $serversList = [ ‘cubegame.pl’, ‘dermc.pl’, ‘feerko.pl’, ‘skyup.pl’, ‘mcosada.pl’, ‘dragon-craft.pl’, ‘gc2.pl’ ]; foreach ($serversList as $server) { $req = Http::get("https://api.mcsrvstat.us/2/$server"); if($req->ok()) { $status = $req->json(); echo( $status[‘motd’][‘html’][0] ); // $serv = Server::updateOrCreate( // [ ..

Read more

I am testing to change my API model from map to list in Flutter but I simply don’t know where to change. Here is how my API looks like: { "1": [ { "tracked_at": "2020-11-29T17:33:42.000000Z", "fuel": 71.05, "level": 2.4867087, "volume": 41671.1 }, { "tracked_at": "2020-11-30T01:41:41.000000Z", "fuel": 70.04, "level": 2.451534, "volume": 41031.36 }, { "tracked_at": "2020-11-30T01:44:05.000000Z", ..

Read more

I am using Laravel 8 and working on API’s. I have created Request Classes for Form validation but when mobile developer hit api validation messages not displaying as required. This is my controller method public function store(InvoiceStoreRequest $request) { try { return $this->responseWithSuccess(true,’Invoice Data’, $this->invoiceInterface->store($request), Response::HTTP_OK); }catch (Exception $exception){ return $this->responseWithError($exception->getMessage(),Response::HTTP_OK); } } here i ..

Read more

so i want to use mylogin api but its not working,it keep push the route to dashboard even the email and the password incorrect here is my code export default { data(){ return{ form: { email: null, password: null }, user: {}, error: false } }, methods: { login() { this.user.append("email", this.form.email); this.user.append("password", this.form.password); this.axios.post(‘http://127.0.0.1:8000/api/login’, ..

Read more

I am getting duplicate items from an API in my adapter but I want to remove those duplicates from my side means from my adapter and print it once any idea how? Thanks in advance. got: duplicate rows in my cardview but through an API. want: just want to print it once and remove those ..

Read more

I am learning about microservers, splitting an application back-end onto multiple servers and then having a single frontend server. What I am confused about is how I would tie them all together and ensuring users are authenticated before allowing actions on certain services. For instance, if A: auth.mydomain.com manages all of the authentication (with its ..

Read more

addProduct() { let uri = ‘http://localhost:8000/api/auth/product’; let jwttoken = localStorage.getItem(‘token’) this.axios.post(uri, this.product, {headers: { Authorization: ‘Bearer ‘ + jwttoken } }).then((response) => { console.log("Success: ", response.data) }).catch( (err) => { console.log("Error: ", err.response.data.errors) }); } This code is giving me the below Exception: "Array to string conversion" What is the problem? I am using Vue-Cli ..

Read more

My scenario is, I get objects in request array in laravel api, which one echo display as; [Object object] From frontend it is being set in the format: {"user":{ ‘id’: 2, "name": "xyz", "auth_token": "…", ……}} I want to read this data from request, but I have tried following ways and nothing worked json_decode($request->user) serialize($request->user) ..

Read more

I have a problem when i´m sending data from react-native to my laravel api, if i write something like this "araña" i get this into my database "arau00f1a", this is my code, how can i fix that?. method: ‘POST’, headers: { ‘Accept’: ‘application/json’, ‘Content-Type’: ‘application/json’, ‘charset’: ‘charset=UTF-8’, ‘Authorization’: ‘Bearer ‘+ result }, Sourc..

Read more

I’ve added an key in the database with abilities "user:addkeys". In my routes/api.php I’ve changed the route to create new keys into this: Route::middleware(‘auth:sanctum’)->post(‘/tokens/create’, function (Request $request) { $user = User::find($request->user_id); $retval = []; if ($user->tokenCan(‘user:addkeys’)) { $capabilities = explode(‘,’,$request->capabilities); $token = $user->createToken($request->token_name, $capabilities); return [‘token’ => $token->plainTextToken]; } return $retval; }); When I run ..

Read more