Wednesday, 16 August 2023

try and catch

 
use Log;

public function function_name(Request $request)
    {            
        try
        {
            $id= $request->oid;
            $data = Order::where('id',$id)->first();  
            if (!is_null($data)) {
                $result =  Order::where('id', $id)->update([
                    'status' => "Approved",
                    'approved_by' => auth()->user()->name,]);  
                    return redirect()->route('order-management')->withStatus('Status updated');   
            }else{                 
                    return redirect()->route('order-management')->withStatus('Record is not available.');   
            } 
        }
        catch (\Exception\Database\QueryException $e)
        {
           Log::info('Query: '.$e->getSql());
           Log::info('Query: Bindings: '.$e->getBindings());
           Log::info('Error: Code: '.$e->getCode());
           Log::info('Error: Message: '.$e->getMessage());  
           return redirect()->route('user-management')->withStatus('Internal Server Error.  Please try again later.');
        } 
    }

Machine Learning - Potato Leaf Disease Prediction

Step 1: import numpy as np import pandas as pd import splitfolders import matplotlib.pyplot as plt import tensorflow as tf from tensorflow i...