How can I create laravel blade template programmatically?

Solution:

  1. Create a view which contains the content of common blade format
  2. on appropriate action, when you need to create a new blade, take the content of the common blade from step 1 using render() function
  3. Then simply use File facade to actually generate the blade using the content. Something like:
    use Illuminate\Support\Facades\File;
    
    //in your controller method
    $file = 'path to your views folder, where you want to generate the blade';
    File::put($file, 'content from step 2');
    

That’s all I can provide based upon the short question without any details, you have asked.

I hope it helps