In this video we are going to learn about Admin Update Order Status.
So let see how can we update the order status from admin panel.
So first of all lets add some column in orders table.
So for that lets create a migration.
So switch to the command prompt and run the following the command.

php artisan make:migration add_delivered_canceled_date_to_orders_table --table=orders

Now lets open the migration and write the following code.


use Illuminate\\Database\\Migrations\\Migration;
use Illuminate\\Database\\Schema\\Blueprint;
use Illuminate\\Support\\Facades\\Schema;

class AddDeliveredCanceledDateToOrdersTable extends Migration
* Run the migrations.
* @return void
public function up()
Schema::table('orders', function (Blueprint $table) {

* Reverse the migrations.
* @return void
public function down()
Schema::table('orders', function (Blueprint $table) {

Now lets migrate this migration.
So switch to command prompt and lets run the command.

php artisan migrate

Now lets run the application

php artisan serve

Now switch to the project
And lets open the admin-order-component.blade.php view file.
And here lets add a drop down inside the table body.

<div class=\"dropdown\">
<button class=\"btn btn-success btn-sm dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\">Status
<span class=\"caret\"></span></button>
<ul class=\"dropdown-menu\">
<li><a href=\"#\" wire:click.prevent=\"updateOrderStatus({{$order->id}},'delivered')\">Delivered</a></li>
<li><a href=\"#\" wire:click.prevent=\"updateOrderStatus({{$order->id}},'canceled')\">Canceled</a></li>

Now here add <th colspan=\"2\" style=\"text-align: center\">Action</th>

Now go to the AdminOrderComponent.php class file.
And here lets create a function for update the order status.

public function updateOrderStatus($order_id,$status)
$order = Order::find($order_id);
$order->status = $status;
if($status == \"delivered\")
$order->delivered_date = DB::raw('CURRENT_DATE');
else if($status == \"canceled\")
$order->canceled_date = DB::raw('CURRENT_DATE');
session()->flash('order_message','Order status has been updated successfully!');

Import DB

use Illuminate\\Support\\Facades\\DB;

Now its done so lets check it.
So switch to the browser and refresh the page.
Now you can see here the dropdown.
Now lets change the status.
So click here and lets select the status delivered.
And here you can status has been changed.
Now click here and details link.
And here you see the deliverd date.
Now lets change the other order status.
Lets change the order status to canceled.
Status changed, now click and check the details and here you can see the canceled date.
So in this way you can Update Order Status so that's all about Admin Update Order Status.