M
M
Mykola Ivashchuk2018-01-27 23:34:20
Laravel
Mykola Ivashchuk, 2018-01-27 23:34:20

How to pass form to slot?

@component('vendor.modals.modal')
  @slot('id')delete{{$manager->id}}@endslot
  @slot('title')@lang('control.user-deleting') {{$manager->name}}@endslot
           @lang('control.user-deleting-confirm',['name'=>$manager->name])
   @slot('footer')
         <form  method="POST" action="{{ route('admin.delete',['id'=>$manager->id]) }}">
                  {{ method_field('DELETE') }}
                  <button type="button" class="btn btn-danger" ><span class="glyphicon glyphicon-ok-sign"></span> @lang('control.confirm')</button>
         </form>
       @endslot
@endcomponent

I pass the form to the slot, but as a result I get this:
<form method="POST" action="http://localhost/managers/1"></form> 
<input type="hidden" name="_method" value="DELETE"> 
<button type="button" class="btn btn-danger">
<span class="glyphicon glyphicon-ok-sign"></span> Да</button>

Component:
<div class="modal fade" id="{{$id}}" tabindex="-1" role="dialog" aria-labelledby="edit" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
                <h4 class="modal-title custom_align" id="Heading">{{$title}}</h4>
            </div>
            <div class="modal-body">
                {{ $slot }}
            </div>
            <div class="modal-footer ">
                <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span> @lang('control.cancel')</button>
                {{$footer}}
            </div>
        </div>
    </div>
</div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mykola Ivashchuk, 2018-01-28
@mykolaim

And all you had to do was remove vue

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question