jeudi 18 février 2016

pass variable from a function to a request in laravel

Hello i am having an issue trying to understand laravel, i am trying to pass data from one function to a request to save in the database and i keep getting this error: Attempt to assign property of non-object

public function active()
{
    $activity = str_random(25);

    $result = purchase::where('active', '=', $activity)->get()->first();
    if(!$result){

        return $activity;
    }
}

public function store(AddOrder $request)
{
    $user = new Bid();
    $user = $request->all();
    $user->activate = $this->active();

    return $user;
}

Thanks alot



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire