Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add User Registrations and Login Add User chage password Add User reset password Add Manage Projects (with tests) Add Manage Users (with test) Add Manage Roles Add Manage Permissions Add Manage Project Payments
- Loading branch information
0 parents
commit 8b9b149
Showing
256 changed files
with
21,152 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,28 @@ | ||
APP_ENV=local | ||
APP_DEBUG=true | ||
APP_KEY=SomeRandomString | ||
|
||
APP_LOCALE=id | ||
APP_TIMEZONE=Asia/Makassar | ||
|
||
DB_HOST=127.0.0.1 | ||
DB_DATABASE=homestead | ||
DB_USERNAME=homestead | ||
DB_PASSWORD=secret | ||
|
||
CACHE_DRIVER=file | ||
SESSION_DRIVER=file | ||
QUEUE_DRIVER=sync | ||
|
||
REDIS_HOST=127.0.0.1 | ||
REDIS_PASSWORD=null | ||
REDIS_PORT=6379 | ||
|
||
MAIL_DRIVER=smtp | ||
MAIL_HOST=mailtrap.io | ||
MAIL_PORT=2525 | ||
MAIL_USERNAME=null | ||
MAIL_PASSWORD=null | ||
MAIL_ENCRYPTION=null | ||
MAIL_FROM=null | ||
MAIL_NAME=null |
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,3 @@ | ||
* text=auto | ||
*.css linguist-vendored | ||
*.less linguist-vendored |
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,6 @@ | ||
/vendor | ||
/node_modules | ||
/public/storage | ||
Homestead.yaml | ||
Homestead.json | ||
.env |
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,33 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Foundation\Inspiring; | ||
|
||
class Inspire extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'inspire'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Display an inspiring quote'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL); | ||
} | ||
} |
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,30 @@ | ||
<?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 = [ | ||
// Commands\Inspire::class, | ||
]; | ||
|
||
/** | ||
* Define the application's command schedule. | ||
* | ||
* @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
* @return void | ||
*/ | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
// $schedule->command('inspire') | ||
// ->hourly(); | ||
} | ||
} |
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,92 @@ | ||
<?php | ||
|
||
namespace App\Entities\Backups; | ||
|
||
use App\Entities\Options\Option; | ||
use BackupManager\Filesystems\Destination; | ||
use BackupManager\Manager; | ||
use League\Flysystem\FileExistsException; | ||
use League\Flysystem\FileNotFoundException; | ||
use Storage; | ||
|
||
/** | ||
* Backups Repository Class | ||
*/ | ||
class BackupsRepository | ||
{ | ||
protected $storage; | ||
protected $storageType; | ||
|
||
public function __construct() | ||
{ | ||
$this->storageType = 'local'; | ||
$this->storage = Storage::disk($this->storageType); | ||
} | ||
|
||
public function getAllFiles() | ||
{ | ||
$backups = \File::allFiles(storage_path('app/backup/db')); | ||
|
||
// Sort files by modified time DESC | ||
usort($backups, function($a, $b) { | ||
return -1 * strcmp($a->getMTime(), $b->getMTime()); | ||
}); | ||
|
||
return $backups; | ||
} | ||
|
||
public function create($backupData) | ||
{ | ||
$manager = app()->make(Manager::class); | ||
$fileName = $backupData['file_name'] ?: date('Y-m-d_Hi'); | ||
try { | ||
$manager->makeBackup()->run('mysql', [ | ||
new Destination($this->storageType, 'backup/db/' . $fileName) | ||
], 'gzip'); | ||
|
||
return $fileName; | ||
|
||
} catch (FileExistsException $e) { | ||
flash()->error('Database tidak dapat dibackup dengan Nama File yang sama.'); | ||
return false; | ||
} | ||
} | ||
|
||
public function restore($fileName) | ||
{ | ||
try { | ||
$manager = app()->make(Manager::class); | ||
$manager->makeRestore()->run($this->storageType, 'backup/db/' . $fileName, 'mysql', 'gzip'); | ||
return true; | ||
|
||
} catch (FileNotFoundException $e) { | ||
flash()->error('Tidak dapat mengembalikan Database.'); | ||
return false; | ||
} | ||
} | ||
|
||
public function delete($fileName) | ||
{ | ||
if ($this->storage->has('backup/db/' . $fileName)) { | ||
$this->storage->delete('backup/db/' . $fileName); | ||
|
||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public function proccessBackupFileUpload($req) | ||
{ | ||
$file = $req->file('backup_file'); | ||
|
||
if ($this->storage->has('backup/db/' . $file->getClientOriginalName())) { | ||
flash()->error('Upload file gagal, terdapat Nama File yang sama.'); | ||
return false; | ||
} | ||
|
||
$result = $this->storage->put('backup/db/' . $file->getClientOriginalName(), file_get_contents($file)); | ||
|
||
return $result; | ||
} | ||
} |
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,21 @@ | ||
<?php | ||
|
||
namespace App\Entities; | ||
|
||
use App\Entities\Users\User; | ||
|
||
/** | ||
* Base Repository Class | ||
*/ | ||
abstract class BaseRepository extends EloquentRepository { | ||
|
||
public function getCustomersList() | ||
{ | ||
return User::orderBy('name')->hasRoles(['customer'])->lists('name','id'); | ||
} | ||
|
||
public function getWorkersList() | ||
{ | ||
return User::orderBy('name')->hasRoles(['worker'])->lists('name','id'); | ||
} | ||
} |
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,106 @@ | ||
<?php | ||
|
||
namespace App\Entities; | ||
|
||
use App\Exceptions\EntityNotFoundException; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
/** | ||
* Eloquent Repository Class | ||
*/ | ||
abstract class EloquentRepository | ||
{ | ||
protected $_paginate = 25; | ||
protected $model; | ||
|
||
public function __construct(Model $model) | ||
{ | ||
$this->model = $model; | ||
} | ||
|
||
public function setModel(Model $model) | ||
{ | ||
$this->model = $model; | ||
} | ||
|
||
public function getAll($q) | ||
{ | ||
return $this->model->latest() | ||
->where('name','like','%'.$q.'%') | ||
->paginate($this->_paginate); | ||
} | ||
|
||
public function getById($id) | ||
{ | ||
return $this->getBy($this->model->getKeyName(), $id); | ||
} | ||
|
||
public function getBy($column, $value) | ||
{ | ||
$model = $this->model->newQuery()->where($column, $value)->get(); | ||
if ($model->count() > 1) | ||
return $model; | ||
|
||
return $model->first(); | ||
} | ||
|
||
public function requireById($id) | ||
{ | ||
$model = $this->getById($id); | ||
if ( ! $model ) | ||
throw new EntityNotFoundException($id, $this->model->getTable()); | ||
return $model; | ||
} | ||
|
||
public function getNewInstance($attributes = []) | ||
{ | ||
return $this->model->newInstance($attributes); | ||
} | ||
|
||
public function create($data) | ||
{ | ||
if ($data instanceof Model) | ||
{ | ||
return $this->storeEloquentModel($data); | ||
} else { | ||
foreach ($data as $key => $value) { | ||
if (!$data[$key]) $data[$key] = null; | ||
} | ||
return $this->storeArray($data); | ||
} | ||
} | ||
|
||
public function update($data = [], $modelId) | ||
{ | ||
foreach ($data as $key => $value) { | ||
if (!$data[$key]) $data[$key] = null; | ||
} | ||
|
||
$model = $this->requireById($modelId); | ||
$model->update($data); | ||
return $model; | ||
} | ||
|
||
public function delete($modelId) | ||
{ | ||
$model = $this->requireById($modelId); | ||
return $model->delete(); | ||
} | ||
|
||
protected function storeEloquentModel(Model $model) | ||
{ | ||
if ($model->getDirty()) | ||
{ | ||
return $model->save(); | ||
} else { | ||
return $model->touch(); | ||
} | ||
} | ||
|
||
protected function storeArray($data) | ||
{ | ||
$model = $this->getNewInstance($data); | ||
$this->storeEloquentModel($model); | ||
return $model; | ||
} | ||
} |
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,16 @@ | ||
<?php | ||
|
||
namespace App\Entities\Masters; | ||
|
||
use App\Entities\Masters\MasterPresenter; | ||
use Illuminate\Database\Eloquent\Model; | ||
use Laracasts\Presenter\PresentableTrait; | ||
|
||
class Master extends Model { | ||
|
||
use PresentableTrait; | ||
|
||
protected $presenter = MasterPresenter::class; | ||
protected $guarded = ['id','created_at','updated_at']; | ||
|
||
} |
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,14 @@ | ||
<?php | ||
|
||
namespace App\Entities\Masters; | ||
|
||
use Laracasts\Presenter\Presenter; | ||
|
||
class MasterPresenter extends Presenter | ||
{ | ||
public function fullName() | ||
{ | ||
return $this->name; | ||
} | ||
|
||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace App\Entities\Masters; | ||
|
||
use App\Entities\BaseRepository; | ||
|
||
/** | ||
* Masters Repository Class | ||
*/ | ||
class MastersRepository extends BaseRepository | ||
{ | ||
protected $model; | ||
|
||
public function __construct(Master $model) | ||
{ | ||
parent::__construct($model); | ||
} | ||
} |
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,12 @@ | ||
<?php | ||
|
||
namespace App\Entities\Options; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Option extends Model { | ||
|
||
protected $fillable = ['key','value']; | ||
protected $table = 'site_options'; | ||
public $timestamps = false; | ||
} |
Oops, something went wrong.