Added option to reset favicon and logo
This commit is contained in:
parent
35590314f4
commit
fed93daf48
|
@ -243,7 +243,7 @@ class AdminController extends Controller
|
||||||
return view('panel/site', $message);
|
return view('panel/site', $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save home message and logo
|
//Save home message, logo and favicon
|
||||||
public function editSite(request $request)
|
public function editSite(request $request)
|
||||||
{
|
{
|
||||||
$message = $request->message;
|
$message = $request->message;
|
||||||
|
@ -282,6 +282,38 @@ class AdminController extends Controller
|
||||||
return back();
|
return back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Delete avatar
|
||||||
|
public function delAvatar()
|
||||||
|
{
|
||||||
|
// Delete existing image
|
||||||
|
$directory = base_path('/littlelink/images/');
|
||||||
|
$files = scandir($directory);
|
||||||
|
$pathinfo = "error.error";
|
||||||
|
foreach($files as $file) {
|
||||||
|
if (strpos($file, "avatar".'.') !== false) {
|
||||||
|
$pathinfo = "avatar". "." . pathinfo($file, PATHINFO_EXTENSION);
|
||||||
|
}}
|
||||||
|
if(file_exists(base_path('/littlelink/images/').$pathinfo)){File::delete(base_path('/littlelink/images/').$pathinfo);}
|
||||||
|
|
||||||
|
return back();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Delete favicon
|
||||||
|
public function delFavicon()
|
||||||
|
{
|
||||||
|
// Delete existing image
|
||||||
|
$directory = base_path('/littlelink/images/');
|
||||||
|
$files = scandir($directory);
|
||||||
|
$pathinfo = "error.error";
|
||||||
|
foreach($files as $file) {
|
||||||
|
if (strpos($file, "favicon".'.') !== false) {
|
||||||
|
$pathinfo = "favicon". "." . pathinfo($file, PATHINFO_EXTENSION);
|
||||||
|
}}
|
||||||
|
if(file_exists(base_path('/littlelink/images/').$pathinfo)){File::delete(base_path('/littlelink/images/').$pathinfo);}
|
||||||
|
|
||||||
|
return back();
|
||||||
|
}
|
||||||
|
|
||||||
//View any of the pages: contact, terms, privacy
|
//View any of the pages: contact, terms, privacy
|
||||||
public function pages(request $request)
|
public function pages(request $request)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,18 @@
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
<script src="{{ asset('resources/ckeditor/ckeditor.js') }}"></script>
|
<script src="{{ asset('resources/ckeditor/ckeditor.js') }}"></script>
|
||||||
|
@php
|
||||||
|
function findFileSite($name){
|
||||||
|
$directory = base_path('/littlelink/images/');
|
||||||
|
$files = scandir($directory);
|
||||||
|
$pathinfo = "error.error";
|
||||||
|
foreach($files as $file) {
|
||||||
|
if (strpos($file, $name.'.') !== false) {
|
||||||
|
$pathinfo = $name. "." . pathinfo($file, PATHINFO_EXTENSION);
|
||||||
|
}}
|
||||||
|
return $pathinfo;
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
<section class="shadow text-gray-400">
|
<section class="shadow text-gray-400">
|
||||||
<h2 class="mb-4 card-header"><i class="bi bi-person"> Site</i></h2>
|
<h2 class="mb-4 card-header"><i class="bi bi-person"> Site</i></h2>
|
||||||
<div class="card-body p-0 p-md-3">
|
<div class="card-body p-0 p-md-3">
|
||||||
|
@ -11,11 +22,11 @@
|
||||||
<form action="{{ route('editSite') }}" enctype="multipart/form-data" method="post">
|
<form action="{{ route('editSite') }}" enctype="multipart/form-data" method="post">
|
||||||
@csrf
|
@csrf
|
||||||
<div class="form-group col-lg-8">
|
<div class="form-group col-lg-8">
|
||||||
<label>Site logo</label>
|
<label>Site logo</label>@if(file_exists(base_path("littlelink/images/").findFileSite('avatar')))<a title="Remove icon" class="hvr-grow p-1 text-danger" style="padding-left:5px;" href="{{ route('delAvatar') }}"><i class="bi bi-trash-fill"></i></a>@endif
|
||||||
<input type="file" class="form-control-file" name="image">
|
<input type="file" class="form-control-file" name="image">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-lg-8">
|
<div class="form-group col-lg-8">
|
||||||
<label>Favicon</label>
|
<label>Favicon</label>@if(file_exists(base_path("littlelink/images/").findFileSite('favicon')))<a title="Remove icon" class="hvr-grow p-1 text-danger" style="padding-left:5px;" href="{{ route('delFavicon') }}"><i class="bi bi-trash-fill"></i></a>@endif
|
||||||
<input type="file" class="form-control-file" name="icon">
|
<input type="file" class="form-control-file" name="icon">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-lg-8">
|
<div class="form-group col-lg-8">
|
||||||
|
|
|
@ -146,6 +146,8 @@ Route::group([
|
||||||
Route::post('/panel/env', [AdminController::class, 'editENV'])->name('editENV');
|
Route::post('/panel/env', [AdminController::class, 'editENV'])->name('editENV');
|
||||||
Route::get('/panel/site', [AdminController::class, 'showSite'])->name('showSite');
|
Route::get('/panel/site', [AdminController::class, 'showSite'])->name('showSite');
|
||||||
Route::post('/panel/site', [AdminController::class, 'editSite'])->name('editSite');
|
Route::post('/panel/site', [AdminController::class, 'editSite'])->name('editSite');
|
||||||
|
Route::get('/panel/site/delavatar', [AdminController::class, 'delAvatar'])->name('delAvatar');
|
||||||
|
Route::get('/panel/site/delfavicon', [AdminController::class, 'delFavicon'])->name('delFavicon');
|
||||||
Route::get('/panel/phpinfo', [AdminController::class, 'phpinfo'])->name('phpinfo');
|
Route::get('/panel/phpinfo', [AdminController::class, 'phpinfo'])->name('phpinfo');
|
||||||
Route::get('/panel/backups', [AdminController::class, 'showBackups'])->name('showBackups');
|
Route::get('/panel/backups', [AdminController::class, 'showBackups'])->name('showBackups');
|
||||||
Route::post('/panel/theme', [AdminController::class, 'deleteTheme'])->name('deleteTheme');
|
Route::post('/panel/theme', [AdminController::class, 'deleteTheme'])->name('deleteTheme');
|
||||||
|
|
Loading…
Reference in New Issue