Category : api

I’m using Laravel Passport 5.7. I want to use own model to authenticate user. When I change custom User into mine Tenancy it always says ‘unarhorized’. auth.php ‘guards’ => [ … ‘api’ => [ ‘driver’ => ‘passport’, ‘provider’ => ‘tenants’, ], … ], ‘providers’ => [ ‘users’ => [ ‘driver’ => ‘eloquent’, ‘model’ => AppUser::class, ..

Read more

If I enter the wrong url address for example http://127.0.0.1:8000/okec Undefined index: poster_path and not 404 not found <div class="col-sm-2 text-center"> <div class="figure"> @if ($infoFilm[‘poster_path’]) <img class="img-fluid img-thumbnail rounded" src="{{ ‘https://image.tmdb.org/t/p/w185/’.$infoFilm[‘poster_path’] }}" alt="Poster"> @else <img class="img-fluid img-thumbnail rounded" src="https://via.placeholder.com/200×240?text=mUaacH" alt="NoImage"> @endif </div> </div> Controller public function details($id) { $infoFilm = Http::withToken(config(‘services.tmdb.token’)) -> get(config(‘services.tmdb.apiurl’).’movie/’.$id) -> json(); ..

Read more

I’m newbie in laravel and i’m trying to get the status of huge number of linux hosts (300+) and display it in view, lets say host1 is accessible via ssh it will return a value which is true and then it will check specific process that are running in the server and if not accessible ..

Read more

I have an issue with exception handling, more specifically the ModelNotFoundException, which is thrown as normal, nothing wrong here, but it’s never caught. I have set up the structure as mentioned in the documentation, inside the register() method of the Handler class(inside app->exceptions): $this->renderable(function (ModelNotFoundException $e, $request) { $modelName = strtolower(class_basename($e->getModel())); return response()->json([‘error’=>"There is no ..

Read more

Laravel Version : 7 File Path : ‘routes/api.php’ I have an api route only for PUT/PATCH, i dont have GET route for this endpoint. in routes/api.php : Route::match( [‘put’, ‘patch’], ‘phc/client/edit’, ‘[email protected]’)->middleware(‘checkTypeUser:ecommerce’ ); When i try this route with Postman, using PUT Method i get this error : SymfonyComponentHttpKernelExceptionMethodNotAllowedHttpException: The GET method is not supported ..

Read more

Laravel 7 I have an api route only for PUT/PATCH, i dont have GET route for this endpoint. Route::match( [‘put’, ‘patch’], ‘phc/client/edit’, ‘[email protected]’)->middleware(‘checkTypeUser:ecommerce’ ); When i try this route with Postman, using PUT Method i get this error : SymfonyComponentHttpKernelExceptionMethodNotAllowedHttpException: The GET method is not supported for this route. Supported methods: PUT, PATCH. What i ..

Read more

Thsi is my flight search api. I have integrated token and marker value but. I t says wrong signature please help. curl_setopt($c,CURLOPT_URL,’http://api.travelpayouts.com/v1/flight_search’); curl_setopt($c,CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’)); curl_setopt($c,CURLOPT_POST,1); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c,CURLOPT_POSTFIELDS,$json); curl_setopt($c,CURLOPT_RETURNTRANSFER,1); $response = curl_exec($c); It says that api not working using ajax request so that is send from controller to get flight response but always ..

Read more

I am using Laravel package Laraodoo to access Odoo API web service. I trying to get the Items description fields from a Quotation? I am already able to get all the items description from a sales order like the following code : $item = $odoo->where(‘origin’, ‘=’, $request->sonumber) ->fields(‘name’); ->get(‘account.invoice.line’); The Above code is valid for ..

Read more

I am setting up a webhook to receive events from stripe. Here is what my api.php looks like: Route::post(‘/webhook’, ‘[email protected]’)->name(‘stripe_webhook’); When I configured stripe to listen to my local deployment of the website, everything works fine. The webhook successfully handles all the sent events. However, in the production environment, after setting up the webhook url ..

Read more

I am setting up a webhook to receive events from stripe. When I configured stripe to listen to my local deployment of the website, everything worked fine. The webhook successfully handled all the sent events. However, in the production environment, after setting up the webhook url in stripe, the url returns a 401 Unauthorized error. ..

Read more

I am setting up a webhook in a Laravel project to receive events from stripe. When I configured stripe to send the webhook events to my local deployment of the website, everything worked fine. The webhook successfully handled all the sent events. However, in the production environment, after setting up the webhook url in stripe, ..

Read more

I’m new to PHP and I’m building API for wishlist, for both guest users and logged-in users in Laravel Lumen. Here I’m using TrailManagerService as session manager It saves data as – for logged in users Array ( [trail_id] => 4b19bd9d-f2da-431b-8aba-d181d7eca736 [inception_time] => 1599813465 [last_used] => 1600762156 [customer_id] => 106210 [customer_data.customer_id] => 106210 [customer_data.firstname] => ..

Read more

I am new to using APIs on laravel. I read through PHP GuzzleHttp, but i couldnt comprehend how to corelate it with ReportingCloud. I am trying to use ReportingCloud Docs from https://docs.reporting.cloud/docs/chapter/introduction/whatisreportingcloud . Having followed the documentation, on https://docs.reporting.cloud/docs/chapter/introduction/first page shows generation a pdf version of invoice. i still dont get the code behind downloading ..

Read more

I am trying to get comment and it’s replies in laravel api,I tried following way and faced to this error, how can I solve it? this is my controller: public function postSinglePage(Request $request) { $post_id=$request->get(‘post_id’); $post = Post::where(‘id’,$post_id)->where(‘status’, ‘=’, 1)->get(); return response([ "posts" => GetPostsSinglePageData::collection($post), ]); } and this is my resource collection to get ..

Read more