update v1.0.7.5

This commit is contained in:
Sujit Prasad
2016-06-14 14:45:24 +05:30
parent 32a73e76d1
commit 050086df09
46 changed files with 2009 additions and 1437 deletions

View File

@@ -27,15 +27,14 @@ use Lang;
* ***************************
* Controller to keep smtp details and fetch where ever needed.
*/
class SettingsController extends Controller
{
class SettingsController extends Controller {
/**
* Create a new controller instance.
*
* @return type void
*/
public function __construct()
{
public function __construct() {
// $this->smtp();
$this->middleware('auth');
$this->middleware('roles');
@@ -53,8 +52,7 @@ class SettingsController extends Controller
*
* @return response
*/
public function widgets()
{
public function widgets() {
return view('themes.default1.admin.helpdesk.theme.widgets');
}
@@ -63,8 +61,7 @@ class SettingsController extends Controller
*
* @return response
*/
public function list_widget()
{
public function list_widget() {
return \Datatable::collection(Widgets::where('id', '<', '7')->get())
->searchColumns('name')
->orderColumns('name', 'title', 'value')
@@ -78,33 +75,33 @@ class SettingsController extends Controller
return $model->value;
})
->addColumn('Actions', function ($model) {
return '<span data-toggle="modal" data-target="#edit_widget'.$model->id.'"><a class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a></span>
<div class="modal fade" id="edit_widget'.$model->id.'">
return '<span data-toggle="modal" data-target="#edit_widget' . $model->id . '"><a class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a></span>
<div class="modal fade" id="edit_widget' . $model->id . '">
<div class="modal-dialog">
<div class="modal-content">
<form action="'.url('edit-widget/'.$model->id).'" method="POST">
<form action="' . url('edit-widget/' . $model->id) . '" method="POST">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">'.strtoupper($model->name).' </h4>
<h4 class="modal-title">' . strtoupper($model->name) . ' </h4>
</div>
<div class="modal-body">
<div class="form-group" style="width:100%">
<label>'.\Lang::get('lang.title').'</label><br/>
<input type="text" name="title" value="'.$model->title.'" class="form-control" style="width:100%">
<label>' . \Lang::get('lang.title') . '</label><br/>
<input type="text" name="title" value="' . $model->title . '" class="form-control" style="width:100%">
</div>
<br/>
<div class="form-group" style="width:100%">
<label>'.\Lang::get('lang.content').'</label><br/>
<textarea name="content" class="form-control" style="width:100%" id="Content'.$model->id.'">'.$model->value.'</textarea>
<label>' . \Lang::get('lang.content') . '</label><br/>
<textarea name="content" class="form-control" style="width:100%" id="Content' . $model->id . '">' . $model->value . '</textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">'.\Lang::get('lang.close').'</button>
<input type="submit" class="btn btn-primary" value="'.\Lang::get('lang.update').'">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">' . \Lang::get('lang.close') . '</button>
<input type="submit" class="btn btn-primary" value="' . \Lang::get('lang.update') . '">
</div>
<script>
$(function () {
$("#Content'.$model->id.'").wysihtml5();
$("#Content' . $model->id . '").wysihtml5();
});
</script>
</form>
@@ -123,15 +120,14 @@ class SettingsController extends Controller
*
* @return type response
*/
public function edit_widget($id, Widgets $widgets, Request $request)
{
public function edit_widget($id, Widgets $widgets, Request $request) {
$widget = $widgets->where('id', '=', $id)->first();
$widget->title = $request->title;
$widget->value = $request->content;
try {
$widget->save();
return redirect()->back()->with('success', $widget->name.Lang::get('lang.saved_successfully'));
return redirect()->back()->with('success', $widget->name . Lang::get('lang.saved_successfully'));
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->getMessage());
}
@@ -142,8 +138,7 @@ class SettingsController extends Controller
*
* @return response
*/
public function social_buttons()
{
public function social_buttons() {
return view('themes.default1.admin.helpdesk.theme.social');
}
@@ -152,8 +147,7 @@ class SettingsController extends Controller
*
* @return response
*/
public function list_social_buttons()
{
public function list_social_buttons() {
return \Datatable::collection(Widgets::where('id', '>', '6')->get())
->searchColumns('name')
->orderColumns('name', 'value')
@@ -164,25 +158,25 @@ class SettingsController extends Controller
return $model->value;
})
->addColumn('Actions', function ($model) {
return '<span data-toggle="modal" data-target="#edit_widget'.$model->id.'"><a class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').'</a></span>
<div class="modal fade" id="edit_widget'.$model->id.'">
return '<span data-toggle="modal" data-target="#edit_widget' . $model->id . '"><a class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a></span>
<div class="modal fade" id="edit_widget' . $model->id . '">
<div class="modal-dialog">
<div class="modal-content">
<form action="'.url('edit-widget/'.$model->id).'" method="POST">
<form action="' . url('edit-widget/' . $model->id) . '" method="POST">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">'.strtoupper($model->name).' </h4>
<h4 class="modal-title">' . strtoupper($model->name) . ' </h4>
</div>
<div class="modal-body">
<br/>
<div class="form-group" style="width:100%">
<label>'.\Lang::get('lang.link').'</label><br/>
<input type="url" name="content" class="form-control" style="width:100%" value="'.$model->value.'">
<label>' . \Lang::get('lang.link') . '</label><br/>
<input type="url" name="content" class="form-control" style="width:100%" value="' . $model->value . '">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">'.\Lang::get('lang.close').'</button>
<input type="submit" class="btn btn-primary" value="'.\Lang::get('lang.update').'">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">' . \Lang::get('lang.close') . '</button>
<input type="submit" class="btn btn-primary" value="' . \Lang::get('lang.update') . '">
</div>
</form>
</div>
@@ -200,15 +194,14 @@ class SettingsController extends Controller
*
* @return type response
*/
public function edit_social_buttons($id, Widgets $widgets, Request $request)
{
public function edit_social_buttons($id, Widgets $widgets, Request $request) {
$widget = $widgets->where('id', '=', $id)->first();
$widget->title = $request->title;
$widget->value = $request->content;
try {
$widget->save();
return redirect()->back()->with('success', $widget->name.' Saved Successfully');
return redirect()->back()->with('success', $widget->name . ' Saved Successfully');
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]);
}
@@ -219,8 +212,7 @@ class SettingsController extends Controller
*
* @return type void
*/
public static function driver()
{
public static function driver() {
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.host', $settings->driver);
@@ -231,8 +223,7 @@ class SettingsController extends Controller
*
* @return type void
*/
public static function host()
{
public static function host() {
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.host', $settings->host);
@@ -243,8 +234,7 @@ class SettingsController extends Controller
*
* @return type void
*/
public static function port()
{
public static function port() {
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.port', intval($settings->port));
@@ -255,8 +245,7 @@ class SettingsController extends Controller
*
* @return type void
*/
public static function from()
{
public static function from() {
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.from', ['address' => $settings->email, 'name' => $settings->company_name]);
@@ -267,8 +256,7 @@ class SettingsController extends Controller
*
* @return type void
*/
public static function encryption()
{
public static function encryption() {
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.encryption', $settings->encryption);
@@ -279,8 +267,7 @@ class SettingsController extends Controller
*
* @return type void
*/
public static function username()
{
public static function username() {
$set = new Smtp();
$settings = Smtp::where('id', '=', '1')->first();
Config::set('mail.username', $settings->email);
@@ -291,8 +278,7 @@ class SettingsController extends Controller
*
* @return type void
*/
public static function password()
{
public static function password() {
$settings = Smtp::first();
if ($settings->password) {
$pass = $settings->password;
@@ -306,8 +292,7 @@ class SettingsController extends Controller
*
* @return type view
*/
public function getsmtp()
{
public function getsmtp() {
$settings = Smtp::where('id', '=', '1')->first();
return view('themes.default1.admin.helpdesk.emails.smtp', compact('settings'));
@@ -318,8 +303,7 @@ class SettingsController extends Controller
*
* @return type view
*/
public function postsmtp(SmtpRequest $request)
{
public function postsmtp(SmtpRequest $request) {
$data = Smtp::where('id', '=', 1)->first();
$data->driver = $request->input('driver');
$data->host = $request->input('host');
@@ -342,8 +326,7 @@ class SettingsController extends Controller
*
* @return type void
*/
public static function smtp()
{
public static function smtp() {
$settings = Smtp::where('id', '=', '1')->first();
if ($settings->password) {
$password = Crypt::decrypt($settings->password);
@@ -364,8 +347,7 @@ class SettingsController extends Controller
*
* @return type view\
*/
public function settings(Smtp $set)
{
public function settings(Smtp $set) {
$settings = $set->where('id', '1')->first();
return view('themes.default1.admin.settings', compact('settings'));
@@ -379,8 +361,7 @@ class SettingsController extends Controller
*
* @return type view
*/
public function PostSettings(Settings $set, Request $request)
{
public function PostSettings(Settings $set, Request $request) {
$settings = $set->where('id', '1')->first();
$pass = $request->input('password');
$password = Crypt::encrypt($pass);
@@ -393,7 +374,7 @@ class SettingsController extends Controller
if (Input::file('logo')) {
$name = Input::file('logo')->getClientOriginalName();
$destinationPath = 'dist/logo';
$fileName = rand(0000, 9999).'.'.$name;
$fileName = rand(0000, 9999) . '.' . $name;
Input::file('logo')->move($destinationPath, $fileName);
$settings->logo = $fileName;
$settings->save();
@@ -412,14 +393,13 @@ class SettingsController extends Controller
*
* @return type
*/
public function version_check()
{
public function version_check() {
$response_url = \URL::route('post-version-check');
echo "<form action='http://www.faveohelpdesk.com/bill/version' method='post' name='redirect'>";
echo "<form action='http://www.faveohelpdesk.com/billing/version' method='post' name='redirect'>";
echo "<input type='hidden' name='_token' value='csrf_token()'/>";
echo "<input type='hidden' name='title' value='helpdeskcommunityedition'/>";
echo "<input type='hidden' name='id' value='19'/>";
echo "<input type='hidden' name='response_url' value='".$response_url."' />";
echo "<input type='hidden' name='response_url' value='" . $response_url . "' />";
echo '</form>';
echo "<script language='javascript'>document.redirect.submit();</script>";
}
@@ -429,38 +409,31 @@ class SettingsController extends Controller
*
* @return type
*/
public function post_version_check(Request $request)
{
public function post_version_check(Request $request) {
$current_version = \Config::get('app.version');
$new_version = $request->value;
if ($current_version == $new_version) {
// echo "No, new Updates";
return redirect()->route('checkupdate')->with('info', ' No, new Updates');
} elseif ($current_version < $new_version) {
$version = Version_Check::where('id', '=', '1')->first();
$version->current_version = $current_version;
$version->new_version = $new_version;
$version->save();
// echo "Version " . $new_version . " is Available";
return redirect()->route('checkupdate')->with('info', ' Version '.$new_version.' is Available');
return redirect()->route('checkupdate')->with('info', ' Version ' . $new_version . ' is Available');
} else {
// echo "Error Checking Version";
return redirect()->route('checkupdate')->with('info', ' Error Checking Version');
}
}
public function getupdate()
{
public function getupdate() {
return \View::make('themes.default1.admin.helpdesk.settings.checkupdate');
}
public function Plugins()
{
public function Plugins() {
return view('themes.default1.admin.helpdesk.settings.plugins');
}
public function GetPlugin()
{
public function GetPlugin() {
$plugins = $this->fetchConfig();
return \Datatable::collection(new Collection($plugins))
@@ -468,15 +441,15 @@ class SettingsController extends Controller
->addColumn('name', function ($model) {
if (array_has($model, 'path')) {
if ($model['status'] == 0) {
$activate = '<a href='.url('plugin/status/'.$model['path']).'>Activate</a>';
$activate = '<a href=' . url('plugin/status/' . $model['path']) . '>Activate</a>';
$settings = ' ';
} else {
$settings = '<a href='.url($model['settings']).'>Settings</a> | ';
$activate = '<a href='.url('plugin/status/'.$model['path']).'>Deactivate</a>';
$settings = '<a href=' . url($model['settings']) . '>Settings</a> | ';
$activate = '<a href=' . url('plugin/status/' . $model['path']) . '>Deactivate</a>';
}
$delete = '<a href= id=delete'.$model['path'].' data-toggle=modal data-target=#del'.$model['path']."><span style='color:red'>Delete</span></a>"
."<div class='modal fade' id=del".$model['path'].">
$delete = '<a href= id=delete' . $model['path'] . ' data-toggle=modal data-target=#del' . $model['path'] . "><span style='color:red'>Delete</span></a>"
. "<div class='modal fade' id=del" . $model['path'] . ">
<div class='modal-dialog'>
<div class=modal-content>
<div class=modal-header>
@@ -485,8 +458,8 @@ class SettingsController extends Controller
<div class=modal-body>
<p>Are you Sure ?</p>
<div class=modal-footer>
<button type=button class='btn btn-default pull-left' data-dismiss=modal id=dismis>".\Lang::get('lang.close').'</button>
<a href='.url('plugin/delete/'.$model['path'])."><button class='btn btn-danger'>Delete</button></a>
<button type=button class='btn btn-default pull-left' data-dismiss=modal id=dismis>" . \Lang::get('lang.close') . '</button>
<a href=' . url('plugin/delete/' . $model['path']) . "><button class='btn btn-danger'>Delete</button></a>
</div>
@@ -494,12 +467,12 @@ class SettingsController extends Controller
</div>
</div>
</div>";
$action = '<br><br>'.$delete.' | '.$settings.$activate;
$action = '<br><br>' . $delete . ' | ' . $settings . $activate;
} else {
$action = '';
}
return ucfirst($model['name']).$action;
return ucfirst($model['name']) . $action;
})
->addColumn('description', function ($model) {
return ucfirst($model['description']);
@@ -508,7 +481,7 @@ class SettingsController extends Controller
return ucfirst($model['author']);
})
->addColumn('website', function ($model) {
return '<a href='.$model['website'].' target=_blank>'.$model['website'].'</a>';
return '<a href=' . $model['website'] . ' target=_blank>' . $model['website'] . '</a>';
})
->addColumn('version', function ($model) {
return $model['version'];
@@ -521,9 +494,8 @@ class SettingsController extends Controller
*
* @return type
*/
public function ReadPlugins()
{
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins';
public function ReadPlugins() {
$dir = app_path() . DIRECTORY_SEPARATOR . 'Plugins';
$plugins = array_diff(scandir($dir), ['.', '..']);
return $plugins;
@@ -536,13 +508,12 @@ class SettingsController extends Controller
*
* @return type
*/
public function PostPlugins(Request $request)
{
public function PostPlugins(Request $request) {
$v = $this->validate($request, ['plugin' => 'required|mimes:application/zip,zip,Zip']);
$plug = new Plugin();
$file = $request->file('plugin');
//dd($file);
$destination = app_path().DIRECTORY_SEPARATOR.'Plugins';
$destination = app_path() . DIRECTORY_SEPARATOR . 'Plugins';
$zipfile = $file->getRealPath();
/*
* get the file name and remove .zip
@@ -551,30 +522,30 @@ class SettingsController extends Controller
$filename2 = str_replace('.zip', '', $filename2);
$filename1 = ucfirst($file->getClientOriginalName());
$filename = str_replace('.zip', '', $filename1);
mkdir($destination.DIRECTORY_SEPARATOR.$filename);
mkdir($destination . DIRECTORY_SEPARATOR . $filename);
/*
* extract the zip file using zipper
*/
\Zipper::make($zipfile)->folder($filename2)->extractTo($destination.DIRECTORY_SEPARATOR.$filename);
\Zipper::make($zipfile)->folder($filename2)->extractTo($destination . DIRECTORY_SEPARATOR . $filename);
$file = app_path().DIRECTORY_SEPARATOR.'Plugins'.DIRECTORY_SEPARATOR.$filename; // Plugin file path
$file = app_path() . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR . $filename; // Plugin file path
if (file_exists($file)) {
$seviceporvider = $file.DIRECTORY_SEPARATOR.'ServiceProvider.php';
$config = $file.DIRECTORY_SEPARATOR.'config.php';
$seviceporvider = $file . DIRECTORY_SEPARATOR . 'ServiceProvider.php';
$config = $file . DIRECTORY_SEPARATOR . 'config.php';
if (file_exists($seviceporvider) && file_exists($config)) {
/*
* move to faveo config
*/
$faveoconfig = config_path().DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$filename.'.php';
$faveoconfig = config_path() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $filename . '.php';
if ($faveoconfig) {
//copy($config, $faveoconfig);
/*
* write provider list in app.php line 128
*/
$app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
$str = "\n\n\t\t\t'App\\Plugins\\$filename"."\\ServiceProvider',";
$app = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
$str = "\n\n\t\t\t'App\\Plugins\\$filename" . "\\ServiceProvider',";
$line_i_am_looking_for = 144;
$lines = file($app, FILE_IGNORE_NEW_LINES);
$lines[$line_i_am_looking_for] = $str;
@@ -588,7 +559,7 @@ class SettingsController extends Controller
*/
$this->deleteDirectory($file);
return redirect()->back()->with('fails', 'Their is no '.$file);
return redirect()->back()->with('fails', 'Their is no ' . $file);
}
} else {
/*
@@ -596,7 +567,7 @@ class SettingsController extends Controller
*/
$this->deleteDirectory($file);
return redirect()->back()->with('fails', 'Their is no <b>config.php or ServiceProvider.php</b> '.$file);
return redirect()->back()->with('fails', 'Their is no <b>config.php or ServiceProvider.php</b> ' . $file);
}
} else {
/*
@@ -604,7 +575,7 @@ class SettingsController extends Controller
*/
$this->deleteDirectory($file);
return redirect()->back()->with('fails', '<b>Plugin File Path is not exist</b> '.$file);
return redirect()->back()->with('fails', '<b>Plugin File Path is not exist</b> ' . $file);
}
}
@@ -615,8 +586,7 @@ class SettingsController extends Controller
*
* @return bool
*/
public function deleteDirectory($dir)
{
public function deleteDirectory($dir) {
if (!file_exists($dir)) {
return true;
}
@@ -627,8 +597,8 @@ class SettingsController extends Controller
if ($item == '.' || $item == '..') {
continue;
}
chmod($dir.DIRECTORY_SEPARATOR.$item, 0777);
if (!$this->deleteDirectory($dir.DIRECTORY_SEPARATOR.$item)) {
chmod($dir . DIRECTORY_SEPARATOR . $item, 0777);
if (!$this->deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) {
return false;
}
}
@@ -637,9 +607,8 @@ class SettingsController extends Controller
return rmdir($dir);
}
public function ReadConfigs()
{
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins'.DIRECTORY_SEPARATOR;
public function ReadConfigs() {
$dir = app_path() . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR;
$directories = scandir($dir);
$files = [];
foreach ($directories as $key => $file) {
@@ -647,7 +616,7 @@ class SettingsController extends Controller
continue;
}
if (is_dir($dir.DIRECTORY_SEPARATOR.$file)) {
if (is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
$files[$key] = $file;
}
}
@@ -656,7 +625,7 @@ class SettingsController extends Controller
$plugins = [];
if (count($files) > 0) {
foreach ($files as $key => $file) {
$plugin = $dir.$file;
$plugin = $dir . $file;
$plugins[$key] = array_diff(scandir($plugin), ['.', '..', 'ServiceProvider.php']);
$plugins[$key]['file'] = $plugin;
}
@@ -666,7 +635,7 @@ class SettingsController extends Controller
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if ($file == 'config.php') {
$config[] = $dir.DIRECTORY_SEPARATOR.$file;
$config[] = $dir . DIRECTORY_SEPARATOR . $file;
}
}
closedir($dh);
@@ -679,8 +648,7 @@ class SettingsController extends Controller
}
}
public function fetchConfig()
{
public function fetchConfig() {
$configs = $this->ReadConfigs();
//dd($configs);
$plugs = new Plugin();
@@ -716,15 +684,14 @@ class SettingsController extends Controller
return $attributes;
}
public function DeletePlugin($slug)
{
$dir = app_path().DIRECTORY_SEPARATOR.'Plugins'.DIRECTORY_SEPARATOR.$slug;
public function DeletePlugin($slug) {
$dir = app_path() . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR . $slug;
$this->deleteDirectory($dir);
/*
* remove service provider from app.php
*/
$str = "'App\\Plugins\\$slug"."\\ServiceProvider',";
$path_to_file = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
$str = "'App\\Plugins\\$slug" . "\\ServiceProvider',";
$path_to_file = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
$file_contents = file_get_contents($path_to_file);
$file_contents = str_replace($str, '//', $file_contents);
file_put_contents($path_to_file, $file_contents);
@@ -737,13 +704,12 @@ class SettingsController extends Controller
return redirect()->back()->with('success', 'Deleted Successfully');
}
public function StatusPlugin($slug)
{
public function StatusPlugin($slug) {
$plugs = new Plugin();
$plug = $plugs->where('name', $slug)->first();
if (!$plug) {
$app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
$str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',";
$app = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
$str = "\n'App\\Plugins\\$slug" . "\\ServiceProvider',";
$line_i_am_looking_for = 144;
$lines = file($app, FILE_IGNORE_NEW_LINES);
$lines[$line_i_am_looking_for] = $str;
@@ -756,8 +722,8 @@ class SettingsController extends Controller
if ($status == 0) {
$plug->status = 1;
$app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
$str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',";
$app = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
$str = "\n'App\\Plugins\\$slug" . "\\ServiceProvider',";
$line_i_am_looking_for = 144;
$lines = file($app, FILE_IGNORE_NEW_LINES);
$lines[$line_i_am_looking_for] = $str;
@@ -768,8 +734,8 @@ class SettingsController extends Controller
/*
* remove service provider from app.php
*/
$str = "\n'App\\Plugins\\$slug"."\\ServiceProvider',";
$path_to_file = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php';
$str = "\n'App\\Plugins\\$slug" . "\\ServiceProvider',";
$path_to_file = base_path() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php';
$file_contents = file_get_contents($path_to_file);
$file_contents = str_replace($str, '//', $file_contents);