3 months ago

Cannot send to store method from controller

Posted 3 months ago by MattB

I have a form inside a modal which isn't talking to the store method of the controller it's sent to. When I move the form outside of the modal to the page that calls the modal, it works fine and I can post to the store method. Can't see what the issue is here. It doesn't matter if I use a custom request or the basic one for validation:

Form Modal:

<div class="modal-body">
          <div class="row">
            <div class="col-12">
              {!! Form::open(['method' =>'POST', 'action'=> '[email protected]']) !!} 
              <div class="form-group {{$errors->has('date') ? 'has-error' : ''}}">
                {!! Form::label('date', 'News Flash Date:') !!}
                {!! Form::text('date', null, ['class'=>'form-control'])!!}
              <div class="form-group">
                {!! Form::submit('Add News Flash', ['class'=>'btn btn-primary']) !!}
              {!! Form::close() !!}

Store Method:

public function store(NewsFlashRequest $request)
        $newsFlash = new Newsflashes();          
          $newsFlash->date = $request->date;
          $newsFlash->published = 0;          
          $newsFlash->number_of_stories = 0;          
          return redirect()->route('admin.newsflash.index');


Route::resource('/admin/newsflashes', 'AdminNewsFlashController', [

From the route list:

 POST      | admin/newsflashes                  |       | App\Http\Controllers\[email protected]                    | web

Please sign in or create an account to participate in this conversation.