2016-12-20 8 views
1

auf meinem Produktionssystem ein Fehler auftritt, während ein Benutzerobjekt innerhalb Warteschlange Ausführung Deserialisierens:Fehler beim Deserialisierung von Modell

[2016-12-20 21:10:01] production.ERROR: Illuminate\Database\Eloquent\ModelNotFoundException: No query results for model [App\User]. in /var/www/virtual/bob/bobnet/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:210 
    Stack trace: 
    #0 /var/www/virtual/bob/bobnet/vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php(45): Illuminate\Database\Eloquent\Builder->findOrFail(137) 

Wenn ich

\App\User::findOrFail(137) 

der richtige Benutzer ausgeführt wird, kann ohne einen Fehler gefunden . Bis zu ein paar Wochen hat alles gut funktioniert. Genauso wie die Deserialisierung meines Dev-Systems. Hat jemand eine Idee, was schief läuft?

Mitteilung:

<?php 

namespace App\Mail; 

use Carbon\Carbon; 
use Illuminate\Bus\Queueable; 
use Illuminate\Mail\Mailable; 
use Illuminate\Queue\SerializesModels; 
use Illuminate\Support\Facades\Mail; 

class GuideNotification extends Mailable 
{ 
    use Queueable, SerializesModels; 

    // Once the data has been set to a public property, it will automatically be available in the view 
    private $template; 
    public $user; 
    public $tour; 
    public $pivot; 
    public $sender; 
    public $date; 

    /** 
    * Create a new message instance. 
    * 
    * @return void 
    */ 
    public function __construct($template = 'emails.status_update', \App\User $user, \App\Tour $tour, $pivot, \App\User $sender = null) 
    { 
     $this->template = $template; 
     $this->user  = $user; 
     $this->tour  = $tour; 
     $this->date  = new Carbon($tour->start); 
     $this->pivot = $pivot; 
     if ($sender) { 
      $this->sender = $sender->fullName(); 
     } 

    } 

    /** 
    * Build the message. 
    * 
    * @return $this 
    */ 
    public function build() 
    { 
     return $this 
      ->to($this->user->email) 
      ->cc(config('bob.bcc_mail'), 'BoB') 
      ->subject($this->generateSubject()) 
      ->view($this->template); 
    } 

    protected function generateSubject() 
    { 
     switch ($this->template) { 
      case 'emails.request': 
       return 'Guide Anfrage ' . $this->tour->name . ' am ' . $this->date->format('d.m.Y') . ' um ' . $this->date->format('H:i') . ' Uhr (ID ' . $this->tour->id . ')'; 
       break; 
      case 'emails.confirmation': 
       return 'Guide Bestätigung ' . $this->tour->name . ' am ' . $this->date->format('d.m.Y') . ' um ' . $this->date->format('H:i') . ' Uhr (ID ' . $this->tour->id . ')'; 
       break; 
      case 'emails.change': 
       return 'Guide Änderung ' . $this->tour->name . ' am ' . $this->date->format('d.m.Y') . ' um ' . $this->date->format('H:i') . ' Uhr (ID ' . $this->tour->id . ')'; 
       break; 
      case 'emails.freesale': 
       return 'Guide Bestätigung "geschnappte" ' . $this->tour->name . ' am ' . $this->date->format('d.m.Y') . ' um ' . $this->date->format('H:i') . ' Uhr (ID ' . $this->tour->id . ')'; 
       break; 
      default: 
       return 'Guide Statusupdate ' . $this->tour->name . ' am ' . $this->date->format('d.m.Y') . ' um ' . $this->date->format('H:i') . ' Uhr (ID ' . $this->tour->id . ')'; 
       break; 
     } 
    } 
} 
+0

woher wird die 'GuideNotification'-Klasse aufgerufen? Haben Sie überprüft, ob das richtige Benutzerobjekt an das Konstrukt übergeben wurde? –

Antwort

0

Lange Rede kurzer Sinn:

Aufgrund einiger Umgebungsvariablen und Ausführungskontext der Warteschlange mit einer anderen PHP-Version gearbeitet wurde, die zu diesem Fehler geführt. Nach der erzwingen der korrekten PHP-Version funktioniert alles gut.

Verwandte Themen