murilo
1 year ago

Static Method for Store , how use Request / Consider Use Cases

Posted 1 year ago by murilo

I saw this tutorial -

https://laracasts.com/series/whip-monstrous-code-into-shape/episodes/2

That is amazing , it shows how to clean up the controller code .

The controller wold be like this -

      public function store(){
                
            $podcast = PurchasePodCast::perform(); 
            return $podcast; 
        
    }

My Question is , If I have to add -

  • request
  • user

Wold be a good approache , to make static like this in the same way ?

      public function store(Request $request){
            $user = $this->user;    
            $podcast = PurchasePodCast::perform(request , $user ); 
            return $podcast; 
        
    }

Thanks

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