samedi 23 juin 2018

php laravel api trigger a function

Hey I managed upload a file with Vue.js to laravel backend with api end point. But I have to trigger a function because I have to add data to db.

  public function store(Request $request)
  {
    if($request->hasFile('file')){
      if ($request->file('file')->isValid()) {
        $request->file->storeAs('gedcom', 'file.ged');
        return ['okay'];
      }
      return ['File corrupted'];
    }
    return ['Not uploaded'];
  }

Uploaded file can be stored in Laravel storage but I have to trigger a function in this store method but im getting http 500 status code on console while trying to upload if I try to trigger an another function in store method. Any alternative way to trigger a function with axios post in that store method?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire