-
-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
192 changed files
with
252,789 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
APP_NAME=Laravel | ||
APP_ENV=local | ||
APP_KEY= | ||
APP_DEBUG=true | ||
APP_URL=http://localhost | ||
|
||
LOG_CHANNEL=stack | ||
LOG_LEVEL=debug | ||
|
||
DB_CONNECTION=mysql | ||
DB_HOST=127.0.0.1 | ||
DB_PORT=3306 | ||
DB_DATABASE=laravel | ||
DB_USERNAME=root | ||
DB_PASSWORD= | ||
|
||
BROADCAST_DRIVER=log | ||
CACHE_DRIVER=file | ||
QUEUE_CONNECTION=sync | ||
SESSION_DRIVER=file | ||
SESSION_LIFETIME=120 | ||
|
||
MEMCACHED_HOST=127.0.0.1 | ||
|
||
REDIS_HOST=127.0.0.1 | ||
REDIS_PASSWORD=null | ||
REDIS_PORT=6379 | ||
|
||
MAIL_MAILER=smtp | ||
MAIL_HOST=mailhog | ||
MAIL_PORT=1025 | ||
MAIL_USERNAME=null | ||
MAIL_PASSWORD=null | ||
MAIL_ENCRYPTION=null | ||
MAIL_FROM_ADDRESS=null | ||
MAIL_FROM_NAME="${APP_NAME}" | ||
|
||
AWS_ACCESS_KEY_ID= | ||
AWS_SECRET_ACCESS_KEY= | ||
AWS_DEFAULT_REGION=us-east-1 | ||
AWS_BUCKET= | ||
|
||
PUSHER_APP_ID= | ||
PUSHER_APP_KEY= | ||
PUSHER_APP_SECRET= | ||
PUSHER_APP_CLUSTER=mt1 | ||
|
||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" | ||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
* text=auto | ||
*.css linguist-vendored | ||
*.scss linguist-vendored | ||
*.js linguist-vendored | ||
CHANGELOG.md export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/node_modules | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
/vendor | ||
.env | ||
.env.backup | ||
.phpunit.result.cache | ||
docker-compose.override.yml | ||
Homestead.json | ||
Homestead.yaml | ||
npm-debug.log | ||
yarn-error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
php: | ||
preset: laravel | ||
disabled: | ||
- no_unused_imports | ||
finder: | ||
not-name: | ||
- index.php | ||
- server.php | ||
js: | ||
finder: | ||
not-name: | ||
- webpack.mix.js | ||
css: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace App\Console; | ||
|
||
use Illuminate\Console\Scheduling\Schedule; | ||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; | ||
|
||
class Kernel extends ConsoleKernel | ||
{ | ||
/** | ||
* The Artisan commands provided by your application. | ||
* | ||
* @var array | ||
*/ | ||
protected $commands = [ | ||
// | ||
]; | ||
|
||
/** | ||
* Define the application's command schedule. | ||
* | ||
* @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
* @return void | ||
*/ | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
// $schedule->command('inspire')->hourly(); | ||
} | ||
|
||
/** | ||
* Register the commands for the application. | ||
* | ||
* @return void | ||
*/ | ||
protected function commands() | ||
{ | ||
$this->load(__DIR__.'/Commands'); | ||
|
||
require base_path('routes/console.php'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace App\Exceptions; | ||
|
||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | ||
use Throwable; | ||
|
||
class Handler extends ExceptionHandler | ||
{ | ||
/** | ||
* A list of the exception types that are not reported. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontReport = [ | ||
// | ||
]; | ||
|
||
/** | ||
* A list of the inputs that are never flashed for validation exceptions. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontFlash = [ | ||
'current_password', | ||
'password', | ||
'password_confirmation', | ||
]; | ||
|
||
/** | ||
* Register the exception handling callbacks for the application. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
$this->reportable(function (Throwable $e) { | ||
// | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Hash; | ||
|
||
use Auth; | ||
use Exception; | ||
|
||
use App\Models\User; | ||
use App\Models\Admin; | ||
use App\Models\Button; | ||
use App\Models\Link; | ||
use App\Models\Page; | ||
|
||
class AdminController extends Controller | ||
{ | ||
//Statistics of the number of clicks and links | ||
public function index() | ||
{ | ||
$userId = Auth::user()->id; | ||
$name = Auth::user()->name; | ||
|
||
$links = Link::where('user_id', $userId)->select('link')->count(); | ||
$clicks = Link::where('user_id', $userId)->sum('click_number'); | ||
|
||
$userNumber = User::count(); | ||
$siteLinks = Link::count(); | ||
$siteClicks = Link::sum('click_number'); | ||
|
||
return view('panel/index', ['name' => $name, 'links' => $links, 'clicks' => $clicks, 'siteLinks' => $siteLinks, 'siteClicks' => $siteClicks, 'userNumber' => $userNumber]); | ||
} | ||
|
||
//Get users by type | ||
public function users(request $request) | ||
{ | ||
$usersType = $request->type; | ||
|
||
switch($usersType){ | ||
case 'all': | ||
$data['users'] = User::select('id', 'name', 'role', 'block')->get(); | ||
return view('panel/users', $data); | ||
break; | ||
case 'user': | ||
$data['users'] = User::where('role', 'user')->select('id', 'name', 'role', 'block')->get(); | ||
return view('panel/users', $data); | ||
break; | ||
case 'vip': | ||
$data['users'] = User::where('role', 'vip')->select('id', 'name', 'role', 'block')->get(); | ||
return view('panel/users', $data); | ||
break; | ||
case 'admin': | ||
$data['users'] = User::where('role', 'admin')->select('id', 'name', 'role', 'block')->get(); | ||
return view('panel/users', $data); | ||
break; | ||
} | ||
} | ||
|
||
//Search user by name | ||
public function searchUser(request $request) | ||
{ | ||
$name = $request->name; | ||
$data['users'] = User::where('name', $name)->select('id', 'name', 'role', 'block')->get(); | ||
return view('panel/users', $data); | ||
} | ||
|
||
//Block user and delete their links | ||
public function blockUser(request $request) | ||
{ | ||
$id = $request->id; | ||
$status = $request->block; | ||
|
||
if($status == 'yes'){ | ||
$block = 'no'; | ||
}elseif($status == 'no'){ | ||
$block = 'yes'; | ||
} | ||
|
||
User::where('id', $id)->update(['block' => $block]); | ||
|
||
Link::where('user_id', $id)->delete(); | ||
|
||
return redirect('panel/users/all'); | ||
} | ||
|
||
//Show user to edit | ||
public function showUser(request $request) | ||
{ | ||
$id = $request->id; | ||
|
||
$data['user'] = User::where('id', $id)->get(); | ||
|
||
return view('panel/edit-user', $data); | ||
|
||
} | ||
|
||
//Save user edit | ||
public function editUser(request $request) | ||
{ | ||
$id = $request->id; | ||
$name = $request->name; | ||
$email = $request->email; | ||
$password = Hash::make($request->password); | ||
$profilePhoto = $request->file('image'); | ||
$littlelink_name = $request->littlelink_name; | ||
$littlelink_description = $request->littlelink_description; | ||
$role = $request->role; | ||
|
||
User::where('id', $id)->update(['name' => $name, 'email' => $email, 'password' => $password, 'littlelink_name' => $littlelink_name, 'littlelink_description' => $littlelink_description, 'role' => $role]); | ||
|
||
if(!empty($profilePhoto)){ | ||
$profilePhoto->move(public_path('/img'), $name . ".png"); | ||
} | ||
|
||
return back(); | ||
} | ||
|
||
//Show site pages to edit | ||
public function showSitePage() | ||
{ | ||
$data['pages'] = Page::select('terms', 'privacy', 'contact')->get(); | ||
return view('panel/pages', $data); | ||
} | ||
|
||
//Save site pages | ||
public function editSitePage(request $request) | ||
{ | ||
$terms = $request->terms; | ||
$privacy = $request->privacy; | ||
$contact = $request->contact; | ||
|
||
Page::first()->update(['terms' => $terms, 'privacy' => $privacy, 'contact' => $contact]); | ||
|
||
return back(); | ||
} | ||
|
||
//Show home message for edit | ||
public function showSite() | ||
{ | ||
$message = Page::select('home_message')->first(); | ||
return view('panel/site', $message); | ||
} | ||
|
||
//Save home message and logo | ||
public function editSite(request $request) | ||
{ | ||
$message = $request->message; | ||
$logo = $request->file('image'); | ||
|
||
Page::first()->update(['home_message' => $message]); | ||
|
||
if(!empty($logo)){ | ||
$logo->move(public_path('/littlelink/images/'), "avatar.png"); | ||
} | ||
|
||
return back(); | ||
} | ||
|
||
//View any of the pages: contact, terms, privacy | ||
public function pages(request $request) | ||
{ | ||
$name = $request->name; | ||
|
||
try { | ||
$data['page'] = Page::select($name)->first(); | ||
} catch (Exception $e) { | ||
return abort(404); | ||
} | ||
|
||
return view('pages', ['data' => $data, 'name' => $name]); | ||
} | ||
} |
Oops, something went wrong.