Answers for "order number generate laravel"

PHP
1

order number generate laravel

public function get_order_number()
{
    return '#' . str_pad($this->id, 8, "0", STR_PAD_LEFT);
}
Posted by: Guest on May-23-2020
2

order number generate laravel

$order = new Order;

$order->user_id = Auth()->id();
$latestOrder = App\Order::orderBy('created_at','DESC')->first();
$order->order_nr = '#'.str_pad($latestOrder->id + 1, 8, "0", STR_PAD_LEFT);
$order->save();
Posted by: Guest on May-23-2020

Code answers related to "order number generate laravel"

Browse Popular Code Answers by Language