mardi 10 novembre 2020

Object of class stdClass could not be converted to string (View: C:\wamp64\www\Application 1\resources\views\admin\soutenance\themeValide.blade.php)

for the past few days I have been blocking part of my code. Indeed I want to retrieve information from my database in order to display them in a table.

web.php

     Route::get('admin/soutenance/themeValide', 'SoutenanceController@index')->name('admin.soutenance.themeValide');

soutenanceController.php

     public function index()
    {
         $themes = DB::table('themes')
                  
                  ->join('soutenances', 'themes.id', '<>', 'soutenances.theme_id')
                  ->join('profs', 'profs.id', '=', 'themes.prof_id')
                  ->join('users', 'users.id', '=', 'themes.user_id')
                  ->select('themes.id', 'themes.title', 'profs.name AS prof_name', 'users.name AS user_name')
                  ->where('themes.validated', '=', true)
                  ->get();
        // dd($themes);
        
         return view('admin.soutenance.themeValide', compact('themes'));
    }

themeValide.blade.php

<div class="box-body">
          <div class="table-responsive">
            <table class="table no-margin">
              <thead>
                  <tr>
                    <th> ID </th>
                    <th> titre </th>
                    <th> Encadreur </th>
                    <th> Etudiant </th>
                    <th> Action </th>
                  </tr>
              </thead>
                <tbody>
                 
                  @forelse($themes as $theme)
                     
                      <tr>
                        <td> </td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td><span class="tools"><a href=""><i class="fa fa-edit"></i></a>
                             | 
                        <i class="fa fa-trash-o"></i></span></td>
                            
                      </tr>
                  @empty
                         <tr>
                      <td></td>
                            <td> pas de Theme validé </td>
                        </tr>
                    
                  @endforelse

                </tbody>
              </table>
              </div>
          </div>

when i do in soutenanceController

dd($themes);

I get the desired result but when I want it displayed in my page themeValide.blade.php, it shows me this error

Object of class stdClass could not be converted to string (View: C:\wamp64\www\Application 1\resources\views\admin\soutenance\themeValide.blade.php)

I would like you to enlighten me, please.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/36mcPNh
via IFTTT

Aucun commentaire:

Enregistrer un commentaire