Skip to content

Commit 6b83352

Browse files
First commit moving to laravel 9.
0 parents  commit 6b83352

3,155 files changed

Lines changed: 1047947 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2
16+
17+
[docker-compose.yml]
18+
indent_size = 4

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
* text=auto
2+
3+
*.blade.php diff=html
4+
*.css diff=css
5+
*.html diff=html
6+
*.md diff=markdown
7+
*.php diff=php
8+
9+
/.github export-ignore
10+
CHANGELOG.md export-ignore
11+
.styleci.yml export-ignore

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/node_modules
2+
/public/build
3+
/public/hot
4+
/public/storage
5+
/storage/*.key
6+
/vendor
7+
.env
8+
.env.backup
9+
.phpunit.result.cache
10+
Homestead.json
11+
Homestead.yaml
12+
auth.json
13+
npm-debug.log
14+
yarn-error.log
15+
/.idea
16+
/.vscode

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p>
2+
3+
<p align="center">
4+
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
5+
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
6+
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
7+
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
8+
</p>
9+
10+
## About Laravel
11+
12+
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
13+
14+
- [Simple, fast routing engine](https://laravel.com/docs/routing).
15+
- [Powerful dependency injection container](https://laravel.com/docs/container).
16+
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
17+
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
18+
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
19+
- [Robust background job processing](https://laravel.com/docs/queues).
20+
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
21+
22+
Laravel is accessible, powerful, and provides tools required for large, robust applications.
23+
24+
## Learning Laravel
25+
26+
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
27+
28+
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
29+
30+
## Laravel Sponsors
31+
32+
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
33+
34+
### Premium Partners
35+
36+
- **[Vehikl](https://vehikl.com/)**
37+
- **[Tighten Co.](https://tighten.co)**
38+
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
39+
- **[64 Robots](https://64robots.com)**
40+
- **[Cubet Techno Labs](https://cubettech.com)**
41+
- **[Cyber-Duck](https://cyber-duck.co.uk)**
42+
- **[Many](https://www.many.co.uk)**
43+
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
44+
- **[DevSquad](https://devsquad.com)**
45+
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
46+
- **[OP.GG](https://op.gg)**
47+
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
48+
- **[Lendio](https://lendio.com)**
49+
50+
## Contributing
51+
52+
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
53+
54+
## Code of Conduct
55+
56+
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
57+
58+
## Security Vulnerabilities
59+
60+
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
61+
62+
## License
63+
64+
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

app/Console/Kernel.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace App\Console;
4+
5+
use Illuminate\Console\Scheduling\Schedule;
6+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7+
8+
class Kernel extends ConsoleKernel
9+
{
10+
/**
11+
* Define the application's command schedule.
12+
*
13+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
14+
* @return void
15+
*/
16+
protected function schedule(Schedule $schedule)
17+
{
18+
// $schedule->command('inspire')->hourly();
19+
}
20+
21+
/**
22+
* Register the commands for the application.
23+
*
24+
* @return void
25+
*/
26+
protected function commands()
27+
{
28+
$this->load(__DIR__.'/Commands');
29+
30+
require base_path('routes/console.php');
31+
}
32+
}

app/Exceptions/Handler.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
6+
use Throwable;
7+
8+
class Handler extends ExceptionHandler
9+
{
10+
/**
11+
* A list of exception types with their corresponding custom log levels.
12+
*
13+
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
14+
*/
15+
protected $levels = [
16+
//
17+
];
18+
19+
/**
20+
* A list of the exception types that are not reported.
21+
*
22+
* @var array<int, class-string<\Throwable>>
23+
*/
24+
protected $dontReport = [
25+
//
26+
];
27+
28+
/**
29+
* A list of the inputs that are never flashed to the session on validation exceptions.
30+
*
31+
* @var array<int, string>
32+
*/
33+
protected $dontFlash = [
34+
'current_password',
35+
'password',
36+
'password_confirmation',
37+
];
38+
39+
/**
40+
* Register the exception handling callbacks for the application.
41+
*
42+
* @return void
43+
*/
44+
public function register()
45+
{
46+
$this->reportable(function (Throwable $e) {
47+
//
48+
});
49+
}
50+
}

app/FileRepository.php

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
<?php
2+
3+
namespace App;
4+
5+
use Illuminate\Support\Facades\Validator;
6+
use Illuminate\Support\Facades\Response;
7+
use Illuminate\Support\Facades\Config;
8+
use Illuminate\Support\Facades\File;
9+
use Intervention\Image\ImageManager;
10+
use App\File;
11+
use Auth;
12+
13+
class FileRepository
14+
{
15+
16+
public function upload( $form_data )
17+
{
18+
$image = new Image;
19+
20+
$validator = Validator::make($form_data, $image->rules(), $image->messages());
21+
22+
if ($validator->fails()) {
23+
24+
return Response::json([
25+
'error' => true,
26+
'message' => $validator->messages()->first(),
27+
'code' => 400
28+
], 400);
29+
30+
}
31+
32+
$photo = $form_data['file'];
33+
34+
$originalName = $photo->getClientOriginalName();
35+
$extension = $photo->getClientOriginalExtension();
36+
$originalNameWithoutExt = substr($originalName, 0, strlen($originalName) - strlen($extension) - 1);
37+
38+
$filename = $this->sanitize($originalNameWithoutExt);
39+
$allowed_filename = $this->createUniqueFilename( $filename, $extension );
40+
41+
$uploadSuccess1 = $this->original( $photo, $allowed_filename );
42+
43+
$uploadSuccess2 = $this->icon( $photo, $allowed_filename );
44+
45+
if( !$uploadSuccess1 || !$uploadSuccess2 ) {
46+
47+
return Response::json([
48+
'error' => true,
49+
'message' => 'Server error while uploading',
50+
'code' => 500
51+
], 500);
52+
53+
}
54+
55+
$sessionImage = new Image;
56+
$sessionImage->filename = $allowed_filename;
57+
$sessionImage->original_name = $originalName;
58+
$sessionImage->save();
59+
60+
$user = \Auth::User();
61+
$user->profile_image_id = $sessionImage->id;
62+
$user->save();
63+
64+
return Response::json([
65+
'filename'=>$sessionImage->filename,
66+
'location'=> "/cdn/".\Auth::User()->id."/thumbnails/".$sessionImage->filename,
67+
'error' => false,
68+
'code' => 200
69+
], 200);
70+
71+
}
72+
73+
public function createUniqueFilename( $filename, $extension )
74+
{
75+
$full_size_dir = Config::get('images.full_size');
76+
$full_image_path = $full_size_dir . $filename . '.' . $extension;
77+
78+
if ( File::exists( $full_image_path ) )
79+
{
80+
// Generate token for image
81+
$imageToken = substr(sha1(mt_rand()), 0, 5);
82+
return $filename . '-' . $imageToken . '.' . $extension;
83+
}
84+
85+
return $filename . '.' . $extension;
86+
}
87+
88+
/**
89+
* Optimize Original Image
90+
*/
91+
public function original( $photo, $filename )
92+
{
93+
$manager = new ImageManager();
94+
$image = $manager->make( $photo )->save(Config::get('images.full_size') . $filename );
95+
96+
return $image;
97+
}
98+
99+
/**
100+
* Create Icon From Original
101+
*/
102+
public function icon( $photo, $filename )
103+
{
104+
$manager = new ImageManager();
105+
$image = $manager->make( $photo )->resize(200, null, function ($constraint) {
106+
$constraint->aspectRatio();
107+
})
108+
->save( Config::get('images.icon_size') . $filename );
109+
110+
return $image;
111+
}
112+
113+
/**
114+
* Delete Image From Session folder, based on original filename
115+
*/
116+
public function delete( $originalFilename)
117+
{
118+
119+
$full_size_dir = Config::get('images.full_size');
120+
$icon_size_dir = Config::get('images.icon_size');
121+
122+
$sessionImage = Image::where('original_name', 'like', $originalFilename)->first();
123+
124+
125+
if(empty($sessionImage))
126+
{
127+
return Response::json([
128+
'error' => true,
129+
'code' => 400
130+
], 400);
131+
132+
}
133+
134+
$full_path1 = $full_size_dir . $sessionImage->filename;
135+
$full_path2 = $icon_size_dir . $sessionImage->filename;
136+
137+
if ( File::exists( $full_path1 ) )
138+
{
139+
File::delete( $full_path1 );
140+
}
141+
142+
if ( File::exists( $full_path2 ) )
143+
{
144+
File::delete( $full_path2 );
145+
}
146+
147+
if( !empty($sessionImage))
148+
{
149+
$sessionImage->delete();
150+
}
151+
152+
return Response::json([
153+
'error' => false,
154+
'code' => 200
155+
], 200);
156+
}
157+
158+
function sanitize($string, $force_lowercase = true, $anal = false)
159+
{
160+
$strip = array("~", "`", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "=", "+", "[", "{", "]",
161+
"}", "\\", "|", ";", ":", "\"", "'", "&#8216;", "&#8217;", "&#8220;", "&#8221;", "&#8211;", "&#8212;",
162+
"—", "–", ",", "<", ".", ">", "/", "?");
163+
$clean = trim(str_replace($strip, "", strip_tags($string)));
164+
$clean = preg_replace('/\s+/', "-", $clean);
165+
$clean = ($anal) ? preg_replace("/[^a-zA-Z0-9]/", "", $clean) : $clean ;
166+
167+
return ($force_lowercase) ?
168+
(function_exists('mb_strtolower')) ?
169+
mb_strtolower($clean, 'UTF-8') :
170+
strtolower($clean) :
171+
$clean;
172+
}
173+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
use Illuminate\Http\Request;
5+
use Illuminate\Foundation\Bus\DispatchesJobs;
6+
use Illuminate\Routing\Controller as BaseController;
7+
use Illuminate\Foundation\Validation\ValidatesRequests;
8+
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
9+
use BitWasp\Bitcoin\Bitcoin;
10+
use BitWasp\Bitcoin\Address;
11+
use BitWasp\Bitcoin\Key\PrivateKeyFactory;
12+
use App\Models\Client;
13+
use App\Models\Invoice;
14+
use App\Models\Timesheet;
15+
16+
class AdminController extends Controller
17+
{
18+
19+
public function Index() {
20+
$clients = Client::where("id", ">=", 1)->get();
21+
$invoices = Invoice::where("id", ">=", 1)->get();
22+
$timesheets = Timesheet::where("id", ">=", 1)->OrderBy("id", "DESC")->get();
23+
return view("admin.index", ["clients"=>$clients, "invoices"=>$invoices, "timesheets"=>$timesheets]);
24+
}
25+
26+
}

0 commit comments

Comments
 (0)