title: Laravel PDF creation Call to undefined method stdClass::save()
body: <p>I made a pdf creator link in my laravel app. But when i click on my link to the PDF i get a 404. This is my code:</p>
  
  <p>Link to the customer: </p>
  
  <pre><code>&lt;a href="/mvs/mvs/public/admin/kunden/pdf/{{ $kunden-&gt;id }}"&gt;Button html&lt;/a&gt;
  </code></pre>
  
  <p>Route:</p>
  
  <pre><code>Route::get('/mvs/mvs/public/admin/kunden/pdf/{id}', 'DynamicPDFController@get_customer_data');
  </code></pre>
  
  <p>PDF Controller:</p>
  
  <pre><code>use Illuminate\Http\Request;
  use DB;
  use PDF;
  
  class DynamicPDFController extends Controller
  {
  function index()
  {
   $customer_data = $this-&gt;get_customer_data();
   $finance_data = $this-&gt;get_finance_data();
   return view('dynamic_pdf')-&gt;with('customer_data', $customer_data);
  }
  
  function get_customer_data($id)
  {
  //Handle PDF stuff here 
  
  $customer_data = DB::table('kundens')
   -&gt;where('id', '=', $id)
   -&gt;firstOrFail();
  
  //Save PDF link to customer here
  
   $customer_data-&gt;save();
   return $customer_data;
  }
  
  function pdf()
  {
   $pdf = \App::make('dompdf.wrapper');
   $pdf-&gt;loadHTML($this-&gt;convert_customer_data_to_html());
   return $pdf-&gt;stream();
  }
  
  function convert_customer_data_to_html()
  {
   $customer_data = $this-&gt;get_customer_data();
   $output = '
   &lt;h3 align="center"&gt;Angebot&lt;/h3&gt;
   &lt;table width="100%" style="border-collapse: collapse; border: 0px;"&gt;
    &lt;tr&gt;
  &lt;th style="border: 1px solid; padding:12px;" width="20%"&gt;Vorname&lt;/th&gt;
  &lt;th style="border: 1px solid; padding:12px;" width="30%"&gt;Nachname&lt;/th&gt;
  &lt;th style="border: 1px solid; padding:12px;" width="15%"&gt;Stadt&lt;/th&gt;
  &lt;th style="border: 1px solid; padding:12px;" width="15%"&gt;PLZ&lt;/th&gt;
  </code></pre>
  
  <p>';<br>
        foreach($customer_data as $kunden)
       {
        $output .= '
        
         '.$kunden->vorname.'
         '.$kunden->nachname.'
         '.$kunden->wohnort.'
         '.$kunden->plz.'
        </p>
  
  <p>The complete routes:</p>
  
  <pre><code>Route::get('/mvs/mvs/public/admin/kunden/pdf/{id}', 
  
  'DynamicPDFController@get_customer_data');
  
  
  Route::get('/home', 'HomeController@index')-&gt;name('home');
  
  Route::resource('admin/kunden', 'KundenController');
  
  Auth::routes();
  
  Route::get('/home', 'HomeController@index')-&gt;name('home');
  
  Route::get('/dynamic_pdf', 'DynamicPDFController@index');
  
  Route::get('/dynamic_pdf/pdf', 'DynamicPDFController@pdf');
  </code></pre>
  
  <p>When i now click on the link "Button HTML" i get a 404 error page. But i dont know why :(</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <pre><code>Call to undefined method stdClass::save()
  </code></pre>
  
  <p>Thats the new Error - i edit the route to the answer.</p>