@Sinnbeck here's my code
public function onUploadGit(){
$id = post()['id'];
$attr = Named::find($id);
$signup_id = $attr['signup_widget_id'];
$signup_widget = Client::find($signup_id);
$token = $signup_widget['token'];
$content = file_get_contents('/supracrm/plugins/bm/brand/clientPortalFiles/index.html');
$content = str_replace('<REPLACE_TOKEN>', $token, $content);
$file = file_put_contents('supracrm/plugins/bm/brand/clientPortalFiles/index.html', $content);
//$file = "plugins/bm/brand/clientPortalFiles/index.html";
$name = $attr['brand'];
$data = array(
'sha' => file_get_contents("plugins/bm/brand/clientPortalFiles/sha.txt"),
'message' => 'New File',
'content' => base64_encode($file),
'committer' => array(
'name' => '',
'email' => '',
)
);
$data_string = json_encode($data);
$url = "https://api.github.com/repos/laqsh11/demo/contents/'$name'/index.html";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'User-Agent: Awesome-Octocat-App',
'Authorization: Bearer ghp_TsBwlcovecD0fnkfhrbfrh408QwUL'
));
$result = curl_exec($ch);
}
and here's the error which i get
"file_get_contents(/supracrm/plugins/bm/brand/clientPortalFiles/index.html): failed to open stream: No such file or directory" on line 92 of D:\xampp\htdocs\supracrm\plugins\bm\brand\controllers\Brand.php