wuschelino22
5 months ago

Edit Function Crud

Posted 5 months ago by wuschelino22

Hello , i want to build Laravel CRUD. And now i habe a Problem with the Edit function.

''' public function edit(Request $request)

{
    $shares = Url::all();
    return view('edit',compact('shares')); 
}

'''

My Index view is this:

'''

@foreach ($categories as $categorie)

{{ $categorie->name}}
  </h2>
  
</div>

<div id="collapse{{$categorie->id}}" class="collapse" aria-labelledby="heading{{$categorie->id}}" data-parent="#accordionExample">
  <div class="card-body">
 


<!-- Einf├╝gen der Daten in die Tabelle nach Kategorie ID -->
@foreach($shares->where('categorie_id', $categorie->id) as $share)
  <a href='{{ $share->urls }}' style="color: black">{{ $share->name }}</a>
  
  <div type="button"  class="btn-primary float-right" onclick="location.href='{{ url('edit') }}'" value="$share->id" >Edit</div>

 
 
  <br>
  
  @endforeach
@endforeach ''' In the Accordion iam using Variables so i dont need so much code.

Now ich have build a EDIT-Button for every entry in the accordion from the Database.

I want to build an Edit view that only shows this entry on wich button i have pressed.

at the moment it only shows the first entry in the Database . I have check this with the following command.

''' @foreach($shares as $share) {{dd($share->name)}} @endforeach

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