Session Expired in Laravel Package Development

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(''); 

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,]

Read more here:

Content Attribution

This content was originally published by hudai at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: