Session Expired in Laravel Package Development

  laravel, laravel-livewire, php

Description
I am using livewire in a laravel package that will plug into a laravel project. I succefully integrated Livewire in my package. The error i am fetching is This page has expired due to inactivty when i click a button that is binded to a component method.
I added csrf token in my base file like

Exact steps to reproduce

  • Create a package inside a laravel project. Just Render a Component
  • From Package Route(Follow the normal implementation of livewire).
  • Render from packages route file Route::get('/acc/test'VoucherComponent::class);
  • While Rending template from livewire php
    component make sure to add packagename before the view name like this.
public function render(){ 
    return view('acc::livewire.voucher-component')->layout('acc::layouts.app'); 
   }

Stripped-down, copy-pastable code snippets
Dependencies

    "php": "^7.3|^8.0",
    "illuminate/support": "^8.15",
    "livewire/livewire": "^2.3",
    "fruitcake/laravel-cors": "^2.0"

Browser: [ Chrome,]

Source: Laravel

Leave a Reply