-
Notifications
You must be signed in to change notification settings - Fork 0
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
181 changed files
with
32,732 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,51 @@ | ||
APP_NAME=Imager | ||
APP_ENV=local | ||
APP_KEY= | ||
APP_DEBUG=true | ||
APP_URL=http:https://localhost | ||
|
||
LOG_CHANNEL=stack | ||
|
||
DB_CONNECTION=sqlite | ||
DB_HOST=127.0.0.1 | ||
DB_PORT=3306 | ||
DB_DATABASE= | ||
DB_USERNAME=root | ||
DB_PASSWORD=root | ||
|
||
BROADCAST_DRIVER=log | ||
CACHE_DRIVER=file | ||
QUEUE_CONNECTION=database | ||
SESSION_DRIVER=cookie | ||
SESSION_LIFETIME=120 | ||
|
||
REDIS_HOST=127.0.0.1 | ||
REDIS_PASSWORD=null | ||
REDIS_PORT=6379 | ||
|
||
MAIL_DRIVER=smtp | ||
MAIL_HOST=smtp.mailtrap.io | ||
MAIL_PORT=2525 | ||
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}" | ||
|
||
TELESCOPE_ENABLED=false | ||
|
||
GOOGLE_CLIENT_ID= | ||
GOOGLE_CLIENT_SECRET= |
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 | ||
Homestead.json | ||
Homestead.yaml | ||
npm-debug.log | ||
yarn-error.log | ||
.idea |
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,37 @@ | ||
# Setup | ||
|
||
### Create Symbolic Link | ||
|
||
There should be a symbolic link for the following folders. | ||
|
||
storage/logos -> public/logos | ||
|
||
### Running FTP and Youtube Upload | ||
|
||
For FTP and Youtube upload to work, the laravel queue should be running. Read following for more, | ||
|
||
- [Robust background job processing](https://laravel.com/docs/queues). | ||
|
||
## Youtube | ||
|
||
To use the youtube, you need client credentials and paste it in the .env file. | ||
|
||
The redirect endpoint for authorization is http:https://example.com/companies/authorize | ||
|
||
GOOGLE_CLIENT_ID= | ||
|
||
GOOGLE_CLIENT_SECRET= | ||
|
||
## Imager Configs | ||
|
||
For more config options, see config/imager.php | ||
|
||
## Image Manipulation | ||
|
||
By default, intervention image uses GD. You can change it to imageick from config/image.php | ||
|
||
## Improvements | ||
|
||
Currently the image manipulation is done by looping over jobs and presets. This way is slow | ||
because everytime the original image should be loaded in memory and processed for each of the section. | ||
If we could loop throught he files first and then the jobs and presets, that would improve the process time. |
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,91 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Support\Facades\Storage; | ||
|
||
class Company extends Model | ||
{ | ||
protected $fillable = [ | ||
'name', 'logo', | ||
'ftp_host', 'ftp_username', 'ftp_password', 'ftp_upload_path', | ||
]; | ||
|
||
protected $casts = [ | ||
'google_access_token' => 'array' | ||
]; | ||
|
||
public function hasValidAccessToken() | ||
{ | ||
if ( | ||
!empty($this->google_access_token) && | ||
strpos($this->getOriginal('google_access_token'), 'access_token') !== false | ||
) { | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public function getAccessToken($fullJson = false) | ||
{ | ||
if ( | ||
!empty($this->google_access_token) && | ||
isset($this->google_access_token['access_token']) | ||
) { | ||
return ($fullJson ? | ||
$this->getOriginal('google_access_token') : | ||
$this->google_access_token['access_token'] | ||
); | ||
} | ||
|
||
return ''; | ||
} | ||
|
||
/** | ||
* Get the google client for the company client details | ||
* | ||
* @return \Google_Client|null | ||
* @throws \Exception | ||
*/ | ||
public function getGoogleClient() | ||
{ | ||
$client_id = config('services.google.client_id', ''); | ||
$client_secret = config('services.google.client_secret', ''); | ||
$scopes = config('services.google.youtube.scopes', ''); | ||
|
||
if (empty($client_id) && empty($client_secret)) { | ||
throw new \Exception('Google client credentials not configured.'); | ||
} | ||
|
||
$client = new \Google_Client(); | ||
$client->setClientId($client_id); | ||
$client->setClientSecret($client_secret); | ||
$client->setScopes($scopes); | ||
$client->setAccessType('offline'); | ||
$client->setApprovalPrompt('force'); | ||
$client->setRedirectUri(url('companies/authorize')); | ||
$client->setState('company_id=' . $this->id); | ||
|
||
if (!empty($this->getAccessToken(true))) { | ||
$client->setAccessToken($this->getAccessToken(true)); | ||
} | ||
|
||
return $client; | ||
} | ||
|
||
public function companyLogo() | ||
{ | ||
$logoDirectory = config('imager.logos_dir', 'logos'); | ||
|
||
return Storage::url($logoDirectory . DIRECTORY_SEPARATOR . $this->logo); | ||
} | ||
|
||
public function getCompanyLogo() | ||
{ | ||
$logoDirectory = config('imager.logos_dir', 'logos'); | ||
|
||
return Storage::get($logoDirectory . DIRECTORY_SEPARATOR . $this->logo); | ||
} | ||
} |
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,42 @@ | ||
<?php | ||
|
||
namespace App\Console; | ||
|
||
use App\Jobs\DeleteProcessedJobs; | ||
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->job(new DeleteProcessedJobs)->daily(); | ||
} | ||
|
||
/** | ||
* 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,51 @@ | ||
<?php | ||
|
||
namespace App\Exceptions; | ||
|
||
use Exception; | ||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | ||
|
||
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 = [ | ||
'password', | ||
'password_confirmation', | ||
]; | ||
|
||
/** | ||
* Report or log an exception. | ||
* | ||
* @param \Exception $exception | ||
* @return void | ||
*/ | ||
public function report(Exception $exception) | ||
{ | ||
parent::report($exception); | ||
} | ||
|
||
/** | ||
* Render an exception into an HTTP response. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Exception $exception | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function render($request, Exception $exception) | ||
{ | ||
return parent::render($request, $exception); | ||
} | ||
} |
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,34 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Support\Facades\Storage; | ||
|
||
class File extends Model | ||
{ | ||
protected $fillable = [ | ||
'job_id', | ||
'name', // filename w/o extension | ||
'extension', // file extension | ||
'folder', // file folder name | ||
'original_name', // original name with extension | ||
'storage_path', // full relative path to storage w file folder | ||
'full_path', // absolute path | ||
]; | ||
|
||
public function getStoragePath() | ||
{ | ||
return ($this->storage_path . DIRECTORY_SEPARATOR . $this->original_name); | ||
} | ||
|
||
public function getFile() | ||
{ | ||
return Storage::get($this->storage_path . DIRECTORY_SEPARATOR . $this->original_name); | ||
} | ||
|
||
public function job() | ||
{ | ||
return $this->belongsTo(Job::class); | ||
} | ||
} |
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,40 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Providers\RouteServiceProvider; | ||
use Illuminate\Foundation\Auth\ConfirmsPasswords; | ||
|
||
class ConfirmPasswordController extends Controller | ||
{ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Confirm Password Controller | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This controller is responsible for handling password confirmations and | ||
| uses a simple trait to include the behavior. You're free to explore | ||
| this trait and override any functions that require customization. | ||
| | ||
*/ | ||
|
||
use ConfirmsPasswords; | ||
|
||
/** | ||
* Where to redirect users when the intended url fails. | ||
* | ||
* @var string | ||
*/ | ||
protected $redirectTo = RouteServiceProvider::HOME; | ||
|
||
/** | ||
* Create a new controller instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
$this->middleware('auth'); | ||
} | ||
} |
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,22 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails; | ||
|
||
class ForgotPasswordController extends Controller | ||
{ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Password Reset Controller | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This controller is responsible for handling password reset emails and | ||
| includes a trait which assists in sending these notifications from | ||
| your application to your users. Feel free to explore this trait. | ||
| | ||
*/ | ||
|
||
use SendsPasswordResetEmails; | ||
} |
Oops, something went wrong.