Call to undefined method App\Plan::findOrFail()

Posted 9 months ago by asad98iftikhar

This is mine model of plan

        use Illuminate\Support\Facades\Cache;
        use Stripe\Stripe;

        // class Plan extends Model
            class Plan
                {
                   public static function getStripePlans(){
                     //Set the API Key
                        Stripe::setApiKey(User::getStripeKey());

                    try{
                     //Fetch all the plans and fetch it
                  return Cache::remember('stripe.plans', 60*24, function () {
                      return \Stripe\Plan::all()->data;
               });
               }
        catch(\Exception $e){
                  return false;
            }
     }
    }

This is mine Controller

         public function show($id){
    
                              //Get the plan id from the cache
                 // $plan=$this->getPlanByIdOrFail($id);
                      $plans=Plan::findOrFail($id);
                  return view('plan',compact('plan'));
                }

Please sign in or create an account to participate in this conversation.