lundi 4 janvier 2016

Laravel 5 - Redirecting to same list view after deleting an list object - Change not visible

I have a view (lets call it 'foo') which basically lists all articles of a user and displays a delete button like that:

{{ Form::open(['url' => 'contents/'.$content->id, 'method' => 'delete', 'class' => 'deleteForm']) }}
    {!! Form::submit("Deaktivieren",['class' => 'btn btn-xs btn-warning']) !!}
{{ Form::close() }}

Edit: The Destory Function

public function destroy ($id){

    Content::findOrFail($id)->update(['expires' => Carbon::now(), 'active'=>false]);

    return redirect('foo');
}

So that the user sees the same page. But since laravel is caching the view, the old view (so with the deleted object) ist displayed.

Is their a smarter pattern to archive this effect? I thought about AJAX but are not really familiar with JS.

Thank you for your time and help, Simon



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1O1t1UP
via IFTTT

Aucun commentaire:

Enregistrer un commentaire