Last active
          November 11, 2022 05:26 
        
      - 
      
- 
        Save DarkGhostHunter/383abdf8615b40f1041913dd45d2958b to your computer and use it in GitHub Desktop. 
    An invokable class for route binding
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| namespace App\Http\Bindings; | |
| class Transport | |
| { | |
| /** | |
| * Resolve the route bind | |
| * | |
| * @param string $value | |
| * @param \Illuminate\Routing\Route $route | |
| * @return \App\Transports\TransportContract | |
| * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException | |
| */ | |
| public function bind(string $value, Route $route) | |
| { | |
| try { | |
| return app(TransportManager::class)->driver($transport); | |
| } catch (\InvalidArgumentException $exception) { | |
| abort(404); | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment