Search code examples
laravelgitignore

Move a line from controller to new file and call it in laravel


ThisController in my local PC's Laravel, there is a line like this.

$result = shell_exec('C:\Users\mypc\AppData\Local\Programs\Python\Python37-32\python.exe test.py '. $text);

but, this is local PC path. so if I push to web server, I need to change to

$result = shell_exec('usr\bin\Python test.py '. $text);

So, I want to cut this line and paste into a new file, and I want to call this line from the new file via ThisContoroller. So, I can make the file to gitignore and I don't get conflict.

But I don't know how to do it. Do you have any suggestion? Thank you.


Solution

  • Regarding to ceejayoz's comment, yes, I could do with .env file. With this thread's answer.