Пример #1
0
 /**
  * Create or update a note
  *
  * @param array $orderNumber
  * @param $note
  * @return static
  */
 public static function createOrUpdate($orderNumber, $text)
 {
     $note = Note::where('order_number', $orderNumber)->first();
     if (!$note) {
         $note = new static();
         $note->order_number = $orderNumber;
         $note->note = $text;
         $note->created_at = Carbon::now()->toDateTimeString();
     } else {
         $note->note = $text;
     }
     $note->updated_at = Carbon::now()->toDateTimeString();
     $note->save();
     return $note;
 }
Пример #2
0
 /**
  * Get the note for the order
  */
 public function getNote()
 {
     $this->note = Note::where('order_number', $this->number)->first();
 }