Passing data to api resource in request doesn't work in Laravel 8

Advertisements Here’s my controller method: public function getQrEntryCardsOfBranch(GetQrEntryCardsRequest $request) { $request->branch = $request->user()->branch(); $qrEntryCards = $this->qrEntryCardService->getQrEntryCardsOfBranch($request->branch->id); return $this->apiResponse(Result::Success, __(‘messages.pacs.qrEntryCardsFetched’), QrEntryCardResource::collection($qrEntryCards), 200); } And here’s my api resource class: class QrEntryCardResource extends JsonResource { /** * Transform the resource into an array. * * @param \Illuminate\Http\Request $request * @return array */ public function toArray($request) { $user… Read More Passing data to api resource in request doesn't work in Laravel 8

Laravel Service Provider is not injecting values into Service class

Advertisements I have a service provider called "MyServiceProvider.php": <?php namespace App\Providers; use App\Services\MyService; use Illuminate\Support\ServiceProvider; class MyServiceProvider extends ServiceProvider { /** * Register services. * * @return void */ public function register() { $this->app->bind(‘my_service’, function ($app) { return new MyService( config(‘services.my_service.url’), config(‘services.my_service.secret’) ); }); } /** * Bootstrap services. * * @return void */ public… Read More Laravel Service Provider is not injecting values into Service class

When is the cancel_url called by Stripe?

Advertisements When calling the checkout session creation : \Stripe\Stripe::setApiKey(env(‘STRIPE_SECRET’)); $checkout_session = \Stripe\Checkout\Session::create([ ‘line_items’ => [ [ ‘price_data’ => [ ‘currency’ => $currency, ‘product_data’ => [ ‘name’ => token_symbol() . ‘ Token’, ], ‘unit_amount_decimal’ => ($trnx_amount / $token)*100 ], ‘quantity’ => $token ] ], ‘mode’ => ‘payment’, ‘success_url’ => route(‘payment.stripe.success’), ‘cancel_url’ => route(‘stripe.cancel’) ]); The Stripe… Read More When is the cancel_url called by Stripe?

Route are not defined (Custom function inside Resources Controller) – Laravel

Advertisements I have checkIn function in LoginController: LoginController.php with Path : Controllers/Backsite/LoginController public function checkIn(Request $request, User $user) { … } Already defined them in web.php Route::group([‘prefix’ => ‘backsite’, ‘as’ => ‘backsite.’, ‘middleware’ => [‘auth:sanctum’, ‘verified’]], function(){ Route::get(‘/login/checkIn’, [LoginController::class, ‘checkIn’]); }); I call them from button in blade.php by using: <button type="button" class="btn btn-primary btn-min-width… Read More Route are not defined (Custom function inside Resources Controller) – Laravel

how to change url for edit in laravel

Advertisements I have an edit page, I have used resource controller for it. Everytime the page redirects from edit (../members/16/edit) it continues with the edit page url (../members/16/members). [where it should only take ../members] How can I remove/change url for edit. Route Route::resource(‘members’, MemberController::class); edit function public function edit(Member $members,$id) { $members = Member::find($id); return… Read More how to change url for edit in laravel

Pass parent id while inserting in 2 columns with one-to-one relation

Advertisements I have 2 columns with one-to-one relation users and doctors: Users _____________ | id | name | |____|______| | 1 | John | |____|______| Doctors _____________________ | id | dep | user_id | |____|_____|_________| | 1 | 2 | 1 | |____|_____|_________| User model has this function that returns the doctor with relation: public… Read More Pass parent id while inserting in 2 columns with one-to-one relation

Path request submitted through Postman issues 404 response

Advertisements Issue Details I am using Laravel 8. There is a patch route. I am trying to submit the patch request through postman. Due to some reasons it shows 404 response. Please let me know if you need more information. Laravel Route use App\Http\Controllers\User\Role\RoleApiController; Route::patch("update-role/{role_id}", [ RoleApiController::class, "Update" ])->name("UpdateRoleApi"); Route Proof in console Controller class… Read More Path request submitted through Postman issues 404 response