Problems to recover data after page redirect

0

I made a file to save the data of the citizen in an array, because only in another step will I have the confirmation if I should really store this data

<?php

namespace App\Services;

class CidadaoStore{

    private static $cidadao = Array();

    public static function setCidadao($data){

        //dd($data);
        self::$cidadao = $data;

        return true;
    }

    public static function getCidadao(){

        return self::$cidadao;
    }
}

But if I use the get after the set this returns the data ok

if(CidadaoStore::setCidadao($request)){
    dd(CidadaoStore::getCidadao());
    return redirect('/enderecos/create');
}else{
    return back()->with('message', 'Falha ao cadastrar usuário!');
}

But if I try to return the array after redirecting the page this is empty.

Is there any way I can get the expected effect without using the cache or database     

asked by anonymous 06.06.2018 / 21:57

0 answers