Commit b8bd627e by M. Faisal Setiyawan

feat (api) : initialize api project.

parents
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
[docker-compose.yml]
indent_size = 4
* text=auto
*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php
/.github export-ignore
CHANGELOG.md export-ignore
/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
/.idea
/.vscode
{
"name": "Lv GraphQL Schema",
"schemaPath": "schema.graphql",
"extensions": {
"endpoints": {
"Default GraphQL Endpoint": {
"url": "http://localhost:8080/graphql",
"headers": {
"user-agent": "JS GraphQL"
},
"introspect": false
}
}
}
}
\ No newline at end of file
php:
preset: laravel
version: 8
disabled:
- no_unused_imports
finder:
not-name:
- index.php
js:
finder:
not-name:
- webpack.mix.js
css: true
<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>
<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
## About Laravel
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:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
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.
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.
## Laravel Sponsors
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).
### Premium Partners
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[OP.GG](https://op.gg)**
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
- **[Lendio](https://lendio.com)**
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
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).
## Security Vulnerabilities
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.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
<?php
# File generated by "php artisan lighthouse:ide-helper".
# Do not edit this file directly.
# This file should be ignored by git as it can be autogenerated.
namespace Illuminate\Foundation\Testing {
class TestResponse
{
/**
* Asserts that the response contains an error from a given category.
*
* @param string $category the name of the expected error category
*
* @return $this
*/
public function assertGraphQLErrorCategory(string $category): self
{
return $this;
}
/**
* Assert that the returned result contains exactly the given validation keys.
*
* @param array<string> $keys the validation keys the result should have
*
* @return $this
*/
public function assertGraphQLValidationKeys(array $keys): self
{
return $this;
}
/**
* Assert that a given validation error is present in the response.
*
* @param string $key the validation key that should be present
* @param string $message the expected validation message
*
* @return $this
*/
public function assertGraphQLValidationError(string $key, string $message): self
{
return $this;
}
/**
* Assert that no validation errors are present in the response.
*
* @return $this
*/
public function assertGraphQLValidationPasses(): self
{
return $this;
}
}
}
namespace Illuminate\Testing {
class TestResponse
{
/**
* Assert the response contains an error with a matching message.
*
* @param \Throwable $error the expected error
*
* @return $this
*/
public function assertGraphQLError(\Throwable $error): self
{
return $this;
}
/**
* Assert the response contains an error with the given message.
*
* @param string $message the expected error message
*
* @return $this
*/
public function assertGraphQLErrorMessage(string $message): self
{
return $this;
}
/**
* Assert the response contains no errors.
*
* @return $this
*/
public function assertGraphQLErrorFree(): self
{
return $this;
}
/**
* Assert the response contains an error from the given category.
*
* @param string $category the name of the expected error category
*
* @return $this
*/
public function assertGraphQLErrorCategory(string $category): self
{
return $this;
}
/**
* Assert the returned result contains exactly the given validation keys.
*
* @param array<string> $keys the validation keys the result should have
*
* @return $this
*/
public function assertGraphQLValidationKeys(array $keys): self
{
return $this;
}
/**
* Assert a given validation error is present in the response.
*
* @param string $key the validation key that should be present
* @param string $message the expected validation message
*
* @return $this
*/
public function assertGraphQLValidationError(string $key, string $message): self
{
return $this;
}
/**
* Assert no validation errors are present in the response.
*
* @return $this
*/
public function assertGraphQLValidationPasses(): self
{
return $this;
}
}
}
namespace GraphQL\Type\Definition {
/**
* @property \Nuwave\Lighthouse\Execution\Arguments\ArgumentSet $argumentSet We monkey patch this onto here to pass it down the resolver chain.
*/
class ResolveInfo
{
}
}
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* 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');
}
}
<?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<int, class-string<Throwable>>
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array<int, string>
*/
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) {
//
});
}
}
<?php
namespace App\GraphQL\Directives;
use Closure;
use GraphQL\Type\Definition\ResolveInfo;
use Nuwave\Lighthouse\Exceptions\DefinitionException;
use Nuwave\Lighthouse\Schema\Directives\BaseDirective;
use Nuwave\Lighthouse\Schema\Values\FieldValue;
use Nuwave\Lighthouse\Support\Contracts\FieldMiddleware;
use Nuwave\Lighthouse\Support\Contracts\GraphQLContext;
/**
* Class CanAccessDirective
* @package App\GraphQL\Directions
*/
class CanAccessDirective extends BaseDirective implements FieldMiddleware
{
/**
* Function definition.
*
* @return string
*/
public static function definition(): string
{
return /** @lang GraphQL */ "
directive @canAccess(
requiredRoles: [String!]
) on FIELD_DEFINITION | OBJECT";
}
/**
* Function handle field.
*
* @param FieldValue $fieldValue
* @param Closure $next
* @return FieldValue
*/
public function handleField(FieldValue $fieldValue, Closure $next): FieldValue
{
$originalResolver = $fieldValue->getResolver();
return $next(
$fieldValue->setResolver(
function ($root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo)
use ($originalResolver) {
$requiredRole = $this->directiveArgValue('requiredRole');
if ($requiredRole === null) {
throw new DefinitionException(
"Missing argument 'requiredRole' for directive '@canAccess'."
);
}
$user = $context->user();
if ($user === null or array_key_exists($user->role()->ur_name, $requiredRole) === false) {
return null;
}
return $originalResolver($root, $args, $context, $resolveInfo);
}
)
);
}
}
\ No newline at end of file
<?php
namespace App\GraphQL\Mutations;
use App\Models\User;
use Error;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\ValidationException;
/**
* Class Login
* @package App\GraphQL\Mutations
*/
class Login
{
/**
* Function invoke login.
*
* @param $_
* @param array $args
* @return mixed
* @throws ValidationException
*/
public function __invoke($_, array $args)
{
$user = User::query()->where('us_email', $args['email'])->first();
$device = request()->header('User-Agent');
if ($user === null or Hash::check($args['password'], $user->us_password) === false) {
throw ValidationException::withMessages([
'email' => ['The provided credentials are incorrect.'],
]);
}
return $user->createToken($device)->plainTextToken;
}
}
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array<int, class-string|string>
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Illuminate\Http\Middleware\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
* The application's route middleware groups.
*
* @var array<string, array<int, class-string|string>>
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array<string, class-string|string>
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
}
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array<int, string>
*/
protected $except = [
//
];
}
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
class PreventRequestsDuringMaintenance extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array<int, string>
*/
protected $except = [
//
];
}
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @param string|null ...$guards
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next, ...$guards)
{
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
}
return $next($request);
}
}
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array<int, string>
*/
protected $except = [
'current_password',
'password',
'password_confirmation',
];
}
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array<int, string|null>
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array<int, string>|string|null
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
}
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array<int, string>
*/
protected $except = [
//
];
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class AnalysisAttributes extends Model
{
use ScopeModels, SoftDeletes;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'aat_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'aat_updated_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const DELETED_AT = 'aat_deleted_on';
/**
* @var string
*/
public string $prefix = 'aat';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'analysis_attributes';
/**
* Set the primary key of the model.
*
* @var string
*/
protected $primaryKey = 'aat_id';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'aat_id',
'aat_attribute',
'aat_active',
'aat_created_on',
'aat_created_by',
'aat_updated_on',
'aat_updated_by',
'aat_deleted_on',
'aat_deleted_by'
];
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
/**
* Class BasketSize
* @package App\Models
*/
class BasketSize extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'bs_created_on';
/**
* The name of the "created at" column.
*
* @var string
*/
const UPDATED_AT = 'bs_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'bs';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'basket_size';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'bs_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'bs_bsg_id',
'bs_ly_id',
'bs_period',
'bs_spending',
'bs_visit',
'bs_active',
'bs_created_on',
'bs_created_by',
'bs_updated_on',
'bs_updated_by',
'bs_deleted_on',
'bs_deleted_by',
];
/**
* Function set relation users model.
*
* @return BelongsTo
*/
public function layer()
{
return $this->belongsTo(Layers::class, 'bs_ly_id', 'ly_id');
}
/**
* Function set relation users model.
*
* @return HasOne
*/
public function basketSizeGroup()
{
return $this->hasOne(group::class, 'bs_bsg_id', 'bsg_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Class BasketSizeGroup
* @package App\Models
*/
class BasketSizeGroup extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'bsg_created_on';
/**
* The name of the "created at" column.
*
* @var string
*/
const UPDATED_AT = 'bsg_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'bsg';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'basket_size_group';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'bsg_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'bsg_name',
'bsg_active',
'bsg_grp_id',
'bsg_created_on',
'bsg_created_by',
'bsg_update_on',
'bsg_update_by',
'bsg_deleted_on',
'bsg_deleted_by',
];
/**
* Function set basket size users model.
*
* @return BelongsTo
*/
public function basketSize()
{
return $this->belongsTo(size::class, 'bs_bsg_id', 'bsg_id');
}
/**
* Function set group users model.
*
* @return BelongsTo
*/
public function group()
{
return $this->belongsTo(Group::class, 'bsg_grp_id', 'grp_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* Class Cannibalization
* @package App\Models
*/
class Cannibalization extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'cn_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'cn_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'cn';
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
public $timestamps = false;
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'cannibalization';
/**
* Set the primary key of the model.
*
* @var string
*/
protected $primaryKey = 'cn_id';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'cn_id',
'cn_name',
'cn_group_id',
'cn_aat_id',
'cn_active',
'cn_created_on',
'cn_created_by',
'cn_updated_on',
'cn_updated_by',
'cn_deleted_on',
'cn_deleted_by'
];
/**
* Function set relation users model.
*
* @return BelongsTo
*/
public function group()
{
return $this->belongsTo(Group::class, 'grp_id', 'cn_group_id');
}
/**
* Function set relation users model.
*
* @return HasMany
*/
public function cannibalization()
{
return $this->hasMany(Cannibalization::class, 'cn_group_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Class CannibalizationAnalysis
* @package App\Models
*/
class CannibalizationAnalysis extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'cna';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'cna_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'cna_updated_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'cannibalization_analysis';
/**
* Set the primary key of the model.
*
* @var string
*/
protected $primaryKey = 'cna_id';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'cn_id',
'cna_name',
'cna_cn_id',
'cna_segmentation',
'cna_start_distance',
'cna_end_distance',
'cna_active',
'cna_created_on',
'cna_created_by',
'cna_updated_on',
'cna_updated_by',
'cna_deleted_on',
'cna_deleted_by'
];
/**
* Function set relation cannibalization model.
*
* @return BelongsTo
*/
public function cannibalization()
{
return $this->belongsTo(Cannibalization::class, 'cn_id', 'cna_cn_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class CannibalizationCatchmentPolygon extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'ccp_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'ccp_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'ccp';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'cannibalization_catchment_polygon';
/**
* Set the primary key of the model.
*
* @var string
*/
protected $primaryKey = 'ccp_id';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'ccp_id',
'ccp_cnp_id',
'ccp_catchment',
'ccp_active',
'ccp_created_on',
'ccp_created_by',
'ccp_updated_on',
'ccp_updated_by',
'ccp_deleted_on',
'ccp_deleted_by'
];
/**
* Function set relation cannibalization polygon model.
*
* @return BelongsTo
*/
public function cannibalizationPolygon()
{
return $this->belongsTo(CannibalizationPolygon::class, 'ccp_cnp_id', 'cnp_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Class CannibalizationCatchmentPolygonVillage
* @package App\Models
*/
class CannibalizationCatchmentPolygonVillage extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'ccv_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'ccv_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'ccv';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'cannibalization_catchment_polygon_village';
/**
* Set the primary key of the model.
*
* @var string
*/
protected $primaryKey = 'ccv_id';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'ccv_id',
'ccv_cnp_id',
'ccv_catchment',
'ccv_active',
'ccv_created_on',
'ccv_created_by',
'ccv_updated_on',
'ccv_updated_by',
'ccv_deleted_on',
'ccv_deleted_by'
];
/**
* Function set relation cannibalization polygon model.
*
* @return BelongsTo
*/
public function cannibalizationPolygon()
{
return $this->belongsTo(CannibalizationPolygon::class, 'ccv_cnp_id', 'cnp_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* Class CannibalizationPolygon
* @package App\Models
*/
class CannibalizationPolygon extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'cnp_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'cnp_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'cnp';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'cannibalization_polygon';
/**
* Set the primary key of the model.
*
* @var string
*/
protected $primaryKey = 'cnp_id';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'cnp_id',
'cnp_name',
'cnp_cna_id',
'cnp_cpt_id',
'cnp_st_id',
'cnp_alias',
'cnp_coordinates',
'cnp_sr',
'cnp_size',
'cnp_red',
'cnp_green',
'cnp_blue',
'cnp_lost_area',
'cnp_active',
'cnp_created_on',
'cnp_created_by',
'cnp_updated_on',
'cnp_updated_by',
'cnp_deleted_on',
'cnp_deleted_by'
];
/**
* Function set relation cannibalization polygon model.
*
* @return HasMany
*/
public function cannibalizationCatchmentPolygon()
{
return $this->hasMany(CannibalizationCatchmentPolygon::class, 'ccp_cnp_id');
}
/**
* Function set relation cannibalization polygon model.
*
* @return HasMany
*/
public function cannibalizationCatchmentPolygonVillage()
{
return $this->hasMany(CannibalizationCatchmentPolygonVillage::class, 'ccv_cnp_id');
}
/**
* Function set relation cannibalization polygon model.
*
* @return BelongsTo
*/
public function cannibalizationAnalysis()
{
return $this->belongsTo(CannibalizationAnalysis::class, 'cnp_cna_id', 'cna_id');
}
/**
* Function set relation cannibalization polygon type model.
*
* @return BelongsTo
*/
public function cannibalizationPolygonType()
{
return $this->belongsTo(type::class, 'cnp_cpt_id', 'cpt_id');
}
/**
* Function set relation cannibalization polygon type model.
*
* @return BelongsTo
*/
public function cannibalizationSites()
{
return $this->belongsTo(sites::class, 'cnp_st_id', 'cns_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* Class CannibalizationPolygonType
* @package App\Models
*/
class CannibalizationPolygonType extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'cpt_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'cpt_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'cpt';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'cannibalization_polygon_type';
/**
* Set the primary key of the model.
*
* @var string
*/
protected $primaryKey = 'cpt_id';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'cpt_id',
'cpt_name',
'cpt_active',
'cpt_created_on',
'cpt_created_by',
'cpt_updated_on',
'cpt_updated_by',
'cpt_deleted_on',
'cpt_deleted_by'
];
/**
* Function set relation cannibalization polygon model.
*
* @return HasMany
*/
public function cannibalizationPolygon()
{
return $this->hasMany(CannibalizationPolygon::class, 'cnp_cpt_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* Class CannibalizationSites
* @package App\Models
*/
class CannibalizationSites extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'cns_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'cns_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'cns';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'cannibalization_sites';
/**
* Set the primary key of the model.
*
* @var string
*/
protected $primaryKey = 'cns_id';
/**
* The attributes that are mass assignable.
*
* @var array $fillable
*/
protected $fillable = [
'cns_id',
'cns_cn_id',
'cns_st_id',
'cns_alias',
'cns_active',
'cns_created_on',
'cns_created_by',
'cns_updated_on',
'cns_updated_by',
'cns_deleted_on',
'cns_deleted_by'
];
/**
* Function set relation sites model.
*
* @return BelongsTo
*/
public function sites()
{
return $this->belongsTo(Sites::class, 'cns_st_id', 'st_id');
}
/**
* Function set relation sites model.
*
* @return HasMany
*/
public function cannibalization()
{
return $this->hasMany(Cannibalization::class, 'cns_cn_id');
}
/**
* Function set relation sites model.
*
* @return HasMany
*/
public function cannibalizationPolygon()
{
return $this->hasMany(CannibalizationPolygon::class, 'cnp_st_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasOne;
/**
* Class ConfigurationSites
*
* @package App\Models
*/
class ConfigurationSites extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'sacf_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'sacf_updated_on';
/**
* @var string
*/
public string $prefix = 'sacf';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'sites_analysis_configuration';
/**
* The primary key for the model.
*
* @var string $primaryKey
*/
protected $primaryKey = 'sacf_id';
/**
* @var array $fillable
*/
protected $fillable = [
'sacf_layers_id',
'sacf_penetration',
'sacf_sa_code',
'sacf_basket_size_group_id',
'sacf_is_template',
'sacf_created_on',
'sacf_created_by',
'sacf_updated_on',
'sacf_updated_by',
'sacf_deleted_on',
'sacf_deleted_by',
];
/**
* Function set relation basket size group model.
*
* @return HasOne
*/
public function basketSizeGroup()
{
return $this->hasOne(group::class, 'sacf_basket_size_group_id', 'bsg_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Class CustomCategory
* @package App\Models
*/
class CustomCategory extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'cc_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'cc_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'cc';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'custom_category';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'cc_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'cc_name',
'cc_parent_id',
'cc_grp_id',
'cc_active',
'cc_created_on',
'cc_created_by',
'cc_updated_on',
'cc_updated_by',
'cc_deleted_on',
'cc_deleted_by',
];
/**
* Function set relation sites model.
*
* @return BelongsTo
*/
public function group()
{
return $this->belongsTo(Group::class, 'cc_grp_id', 'grp_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
/**
* Class CustomLayer
* @package App\Models
*/
class CustomLayer extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'cl';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'cl_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'cl_updated_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'custom_layer';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'cl_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'cl_name',
'cl_lt_id',
'cl_ly_id',
'cl_filter_field',
'cl_filter_value',
'cl_out_field',
'cl_active',
'cl_created_on',
'cl_created_by',
'cl_updated_on',
'cl_updated_by',
'cl_deleted_on',
'cl_deleted_by',
];
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
/**
* Class DefaultAnalysisField
* @package App\Models
*/
class DefaultAnalysisField extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'daf';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'daf_created_on';
/**
* The name of the "created at" column.
*
* @var string
*/
const UPDATED_AT = 'daf_updated_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'default_analysis_field';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'daf_id';
/**
* @var string[]
*/
protected $fillable = [
'daf_ly_id',
'daf_grp_id',
'daf_jumlah_provinsi',
'daf_jumlah_kabupaten',
'daf_jumlah_kecamatan',
'daf_jumlah_desa',
'daf_density',
'daf_area_name',
'daf_size_area',
'daf_active',
'daf_created_on',
'daf_created_by',
'daf_updated_on',
'daf_updated_by',
'daf_deleted_on',
'daf_deleted_by',
];
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* Class Group
* @package App\Models
*/
class Group extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'grp';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'grp_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'grp_updated_on';
/**
* @var string $primaryKey
*/
protected $primaryKey = 'grp_id';
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $fillable = [
'grp_name',
];
/**
* Function set relation users model.
*
* @return HasMany
*/
public function users()
{
return $this->hasMany(User::class, 'us_grp_id');
}
/**
* Function set relation group layers model.
*
* @return HasMany
*/
public function groupLayers(){
return $this->hasMany(GroupLayers::class, 'grl_grp_id', 'grp_id');
}
}
\ No newline at end of file
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
/**
* Class GroupCustomLayer
* @package App\Models
*/
class GroupCustomLayer extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'gcl';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'gcl_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'gcl_updated_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'group_custom_layer';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'gcl_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'gcl_name',
'gcl_cl_source',
'gcl_active',
'gcl_created_on',
'gcl_created_by',
'gcl_updated_on',
'gcl_updated_by',
'gcl_deleted_on',
'gcl_deleted_by',
];
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Testing\Fluent\Concerns\Has;
/**
* Class GroupLayers
* @package App\Models
*/
class GroupLayers extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'grl_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'grl_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'grl';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'group_layers';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'grl_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'grl_grp_id',
'grl_ly_id',
'grl_active',
'grl_created_on',
'grl_created_by',
'grl_updated_on',
'grl_updated_by',
'grl_deleted_on',
'grl_deleted_by',
];
/**
* Function set relation group model.
*
* @return BelongsTo
*/
public function group()
{
return $this->belongsTo(Group::class, 'grl_grp_id', 'grp_id');
}
/**
* Function set relation group model.
*
* @return HasOne
*/
public function layers()
{
return $this->hasOne(Layers::class, 'grl_ly_id', 'ly_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Class GroupPlan
* @package App\Models
*/
class GroupPlan extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'gpp_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'gpp_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'gpp';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'group_plan';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'gpp_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'gpp_pl_id',
'gpp_grp_id',
'gpp_number_of_user',
'gpp_number_of_site',
'gpp_discount',
'gpp_expired_on',
'gpp_active',
'gpp_created_on',
'gpp_created_by',
'gpp_updated_on',
'gpp_updated_by',
'gpp_deleted_on',
'gpp_deleted_by',
];
/**
* Function set relation group model.
*
* @return BelongsTo
*/
public function group()
{
return $this->belongsTo(Group::class, 'gpp_grp_id', 'grp_id');
}
/**
* Function set relation plan model.
*
* @return BelongsTo
*/
public function plan()
{
return $this->belongsTo(Plans::class, 'gpp_pl_id', 'pl_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Class GroupService
* @package App\Models
*/
class GroupService extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'gsv_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'gsv_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'gsv';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'group_service';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'gsv_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'gsv_grp_id',
'gsv_sv_id',
'gsv_active',
'gsv_created_on',
'gsv_created_by',
'gsv_updated_on',
'gsv_updated_by',
'gsv_deleted_on',
'gsv_deleted_by',
];
/**
* Function set relation group model.
*
* @return BelongsTo
*/
public function group()
{
return $this->belongsTo(Group::class, 'gsv_grp_id', 'grp_id');
}
/**
* Function set relation service model.
*
* @return BelongsTo
*/
public function service()
{
return $this->belongsTo(Services::class, 'gsv_sv_id', 'sv_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Class GroupTrial
* @package App\Models
*/
class GroupTrial extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'gtr_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'gtr_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'gtr';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'group_trial';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'gtr_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'gtr_pl_id',
'gtr_us_id',
'gtr_expired_on',
'gtr_active',
'gtr_created_on',
'gtr_created_by',
'gtr_updated_on',
'gtr_updated_by',
'gtr_deleted_on',
'gtr_deleted_by',
];
/**
* Function set relation user model;
*
* @return BelongsTo
*/
public function user()
{
return $this->belongsTo(User::class, 'gtr_us_id', 'us_id');
}
/**
* Function set relation plan model.
*
* @return BelongsTo
*/
public function plan()
{
return $this->belongsTo(Plans::class, 'gtr_pl_id', 'gtr_us_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* Class GroupType
* @package App\Models
*/
class GroupType extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'grt_created_on';
/**
* The name of the "created at" column.
*
* @var string
*/
const UPDATED_AT = 'grt_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'grt';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'group_type';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'grt_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'grt_name',
'grt_code',
'grt_active',
'grt_created_on',
'grt_created_by',
'grt_update_on',
'grt_update_by',
'grt_deleted_on',
'grt_deleted_by',
];
/**
* Function relation group.
*
* @return HasMany
*/
public function group()
{
return $this->hasMany(Group::class, 'grp_grt_id', 'grt_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* Class LayerCategory
* @package App\Models
*/
class LayerCategory extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'lc';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'lc_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'lc_updated_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'layer_category';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'lc_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'lc_name',
'lc_parent',
'lc_order',
'lc_active',
'lc_created_on',
'lc_created_by',
'lc_updated_on',
'lc_updated_by',
'lc_deleted_on',
'lc_deleted_by',
];
/**
* Function set relation layers model.
*
* @return HasMany
*/
public function layers()
{
return $this->hasMany(Layers::class, 'ly_lc_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
/**
* Class LayerDetail
* @package App\Models
*/
class LayerDetail extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'ld_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'ld_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'ld';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'layer_detail';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'ld_id';
/**
* @var array
*/
protected $fillable = [
'ld_ly_id',
'ld_url_id',
'ld_sv_id',
'ld_title_field',
'ld_out_field',
'ld_query_field',
'ld_ta_id',
'ld_distribution',
'ld_uom',
'ld_analysis_field',
'ld_analysis_label',
'ld_statistic_type',
'ld_field_type',
'ld_analysis',
'ld_active',
'ld_created_on',
'ld_created_by',
'ld_updated_on',
'ld_updated_by',
'ld_deleted_on',
'ld_deleted_by',
];
/**
* Function set relation layers model.
*
* @return HasOne
*/
public function layer()
{
return $this->hasOne(Layers::class, 'ld_ly_id', 'ly_id');
}
/**
* Function set relation services model.
*
* @return BelongsTo
*/
public function service()
{
return $this->belongsTo(Services::class, 'ld_sv_id', 'sv_id');
}
/**
* Function set relation type area model.
*
* @return BelongsTo
*/
public function typeArea()
{
return $this->belongsTo(TypeArea::class, 'ld_ta_id', 'ta_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* Class LayerFilter
* @package App\Models
*/
class LayerFilter extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'lf_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'lf_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'lf';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'layer_filter';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'lf_id';
/**
* @var array
*/
protected $fillable = [
'lf_name',
'lf_layer_type_id',
'lf_type_area_id',
'lf_us_id',
'lf_properties',
'lf_source',
'lf_out_fields',
'lf_file_hash_name',
'lf_active',
'lf_created_on',
'lf_created_by',
'lf_updated_on',
'lf_updated_by',
'lf_deleted_on',
'lf_deleted_by',
];
/**
* Function set relation layer filter detail model.
*
* @return HasMany
*/
public function details()
{
return $this->hasMany(LayerFilterDetail::class, 'lfd_id');
}
/**
* Function set relation type area model.
*
* @return BelongsTo
*/
public function typeArea()
{
return $this->belongsTo(TypeArea::class, 'lf_type_area_id', 'ta_id');
}
/**
* Function set relation users model.
*
* @return BelongsTo
*/
public function users()
{
return $this->belongsTo(User::class, 'lf_us_id', 'ud_id');
}
/**
* Function set relation layer type model.
*
* @return BelongsTo
*/
public function layerType()
{
return $this->belongsTo(LayerType::class, 'lf_layer_type_id', 'lt_id');
}
}
\ No newline at end of file
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Class LayerFilterDetail
* @package App\Models
*/
class LayerFilterDetail extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'lfd_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'lfd_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'lfd';
/**
* @var array $casts
*/
public $casts = [
'lfd_attributes' => 'array',
'lfd_geometry' => 'array'
];
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'layer_filter_detail';
/**
* The primary key for the model.
*
* @var string $primaryKey
*/
protected $primaryKey = 'lfd_id';
/**
* @var array $fillable
*/
protected $fillable = [
'lfd_layer_filter_id',
'lfd_attributes',
'lfd_geometry',
'lfd_created_on',
'lfd_created_by',
'lfd_updated_on',
'lfd_updated_by',
'lfd_deleted_on',
'lfd_deleted_by',
];
/**
* Function set relation layer filter model.
*
* @return BelongsTo
*/
public function layerFilter()
{
return $this->belongsTo(LayerFilter::class, 'lfd_layer_filter_id', 'lfd_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Class LayerMapping
* @package App\Models
*/
class LayerMapping extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'lm_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'lm_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'lm';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'layer_mapping';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'lm_id';
protected $fillable = [
'lm_label',
'lm_ly_id',
'lm_cc_id',
'lm_stp_id',
'lm_grp_id',
'lm_active',
'lm_created_on',
'lm_created_by',
'lm_updated_on',
'lm_updated_by',
'lm_deleted_on',
'lm_deleted_by',
];
/**
* Function set relation layers model.
*
* @return BelongsTo
*/
public function layers()
{
return $this->belongsTo(Layers::class, 'lm_ly_id', 'ly_id');
}
/**
* Function set relation custom category model.
*
* @return BelongsTo
*/
public function customCategory()
{
return $this->belongsTo(CustomCategory::class, 'lm_cc_id', 'cc_id');
}
/**
* Function set relation site type model.
*
* @return BelongsTo
*/
public function siteType()
{
return $this->belongsTo(type::class, 'lm_stp_id', 'stp_id');
}
/**
* Function set relation group model.
*
* @return BelongsTo
*/
public function group()
{
return $this->belongsTo(Group::class, 'lm_grp_id', 'grp_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
/**
* Class LayerType
* @package App\Models
*/
class LayerType extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'lt';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'lt_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'lt_updated_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'layer_type';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'lt_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'lt_name',
'lt_active',
'lt_created_on',
'lt_created_by',
'lt_updated_on',
'lt_updated_by',
'lt_deleted_on',
'lt_deleted_by',
];
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
/**
* Class Layers
* @package App\Models
*/
class Layers extends Model
{
use ScopeModels;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'ly_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'ly_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'ly';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'layers';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'ly_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'ly_name',
'ly_description',
'ly_lc_id',
'ly_lt_id',
'ly_viewer',
'ly_custom_layer',
'ly_active',
'ly_created_on',
'ly_created_by',
'ly_updated_on',
'ly_updated_by',
'ly_deleted_on',
'ly_deleted_by',
];
/**
* Function set relation basket size model.
*
* @return BelongsTo
*/
public function basketSize()
{
return $this->belongsTo(size::class, 'bs_ly_id', 'ly_id');
}
/**
* Function set relation category model.
*
* @return BelongsTo
*/
public function category()
{
return $this->belongsTo(LayerCategory::class, 'ly_lc_id', 'lc_id');
}
/**
* Function set relation layer type model.
*
* @return BelongsTo
*/
public function type()
{
return $this->belongsTo(LayerType::class, 'ly_lt_id', 'lt_id');
}
/**
* Function set relation layer detail model.
*
* @return HasOne
*/
public function details()
{
return $this->hasOne(LayerDetail::class, 'ld_ly_id', 'ly_id');
}
/**
* Function set relation layer detail model.
*
* @return HasOne
*/
public function groupLayer()
{
return $this->hasOne(GroupLayers::class, 'grl_ly_id', 'ly_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
/**
* Class PlanDescriptions
* @package App\Models
*/
class PlanDescriptions extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'pld';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'pld_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'pld_updated_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'plan_descriptions';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'pld_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'pld_pl_id',
'pld_description',
'pld_active',
'pld_created_on',
'pld_created_by',
'pld_updated_on',
'pld_updated_by',
'pld_deleted_on',
'pld_deleted_by',
];
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
/**
* Class Plans
* @package App\Models
*/
class Plans extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'pl';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'pl_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'pl_updated_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'plans';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'pl_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'pl_name',
'pl_number_of_user',
'pl_number_of_site',
'pl_price',
'pl_min_period',
'pl_active',
'pl_created_on',
'pl_created_by',
'pl_updated_on',
'pl_updated_by',
'pl_deleted_on',
'pl_deleted_by',
];
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
/**
* Class Relations
* @package App\Models
*/
class Relations extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'rel';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'rel_created_on';
/**
* The name of the "created at" column.
*
* @var string
*/
const UPDATED_AT = 'rel_updated_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'relations';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'rel_id';
protected $fillable = [
'rel_name',
'rel_code',
'rel_active',
'rel_created_on',
'rel_created_by',
'rel_updated_on',
'rel_updated_by',
'rel_deleted_on',
'rel_deleted_by',
];
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
/**
* Class Services
* @package App\Models
*/
class Services extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'sv';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'sv_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'sv_updated_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'services';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'sv_id';
/**
* @var string[]
*/
protected $fillable = [
'sv_name',
'sv_code',
'sv_url',
'sv_active',
'sv_created_on',
'sv_created_by',
'sv_updated_on',
'sv_updated_by',
'sv_deleted_on',
'sv_deleted_by',
];
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
/**
* Class SiteAnalysis
* @package App\Models
*/
class SiteAnalysis extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'sa';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'sa_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'sa_updated_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'site_analysis';
/**
* Set the primary key of the model.
*
* @var string
*/
protected $primaryKey = 'sa_id';
/**
* The attributes that are mass assignable.
*
* @var array $fillable
*/
protected $fillable = [
'sa_st_id',
'sa_code',
'sa_name',
'sa_name_detail',
'sa_coordinates',
'sa_spatial_reference',
'sa_attributes',
'sa_polygon_length',
'sa_active',
'sa_created_on',
'sa_created_by',
'sa_updated_on',
'sa_updated_by',
'sa_deleted_on',
'sa_deleted_by'
];
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
/**
* Class SiteType
* @package App\Models
*/
class SiteType extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'stp';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'stp_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'stp_updated_on';
/**
* The table associated with the model.
*
* @var string $table
*/
protected $table = 'site_type';
/**
* The primary key for the model.
*
* @var string $primaryKey
*/
protected $primaryKey = 'stp_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'stp_name',
'stp_active',
'stp_created_on',
'stp_created_by',
'stp_updated_on',
'stp_updated_by',
'stp_deleted_on',
'stp_deleted_by',
];
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
/**
* Class Sites
* @package App\Models
*/
class Sites extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'st';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'st_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'st_updated_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'sites';
/**
* Set the primary key of the model.
*
* @var string
*/
protected $primaryKey = 'st_id';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'st_name',
'st_address',
'st_description',
'st_grp_id',
'st_stp_id',
'st_longitude',
'st_latitude',
'st_active',
'st_created_on',
'st_created_by',
'st_updated_on',
'st_updated_by',
'st_deleted_on',
'st_deleted_by'
];
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
/**
* Class TypeArea
* @package App\Models
*/
class TypeArea extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'ta';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'ta_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'ta_updated_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'type_area';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'ta_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'ta_name',
'ta_code',
'ta_active',
'ta_created_on',
'ta_created_by',
'ta_updated_on',
'ta_updated_by',
'ta_deleted_on',
'ta_deleted_by'
];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Models\UseOfReportsDetail;
class UseOfReports extends Model
{
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'uor_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'uor_updated_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'use_of_reports';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'uor_id';
protected $fillable = [
'uor_quota',
'uor_grp_id',
'uor_default',
'uor_active',
'uor_created_on',
'uor_created_by',
'uor_updated_on',
'uor_updated_by',
'uor_deleted_on',
'uor_deleted_by',
];
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
public $timestamps = false;
/**
* Function get all data use of reports.
*
* @return array
*/
public function getAllData(): array
{
$useOfReports = $this->select(
[
'use_of_reports.*',
'grp.grp_id',
'grp.grp_name'
]
)->leftJoin('groups AS grp', 'use_of_reports.uor_grp_id', '=', 'grp.grp_id')
->whereNull('grp_deleted_on')
->whereNull('uor_deleted_on')
->get()->toArray();
foreach ($useOfReports as $key => $value) {
$useOfReports[$key]['details'] = (new UseOfReportsDetail())->select(['use_of_reports_detail.*'])
->where('uod_uor_id', $value['uor_id'])
->whereNull('uod_deleted_on')
->get()
->toArray();
};
return $useOfReports;
}
/**
* Function get all active data use of reports.
*
* @return array
*/
public function getAllActiveData(): array
{
$useOfReports = $this->select(
[
'use_of_reports.*',
'grp.grp_id',
'grp.grp_name'
]
)->leftJoin('groups AS grp', 'use_of_reports.uor_grp_id', '=', 'grp.grp_id')
->whereNull('grp_deleted_on')
->whereNull('uor_deleted_on')
->where('uor_active', '=', 'Y')
->get()->toArray();
foreach ($useOfReports as $key => $value) {
$useOfReports[$key]['details'] = (new UseOfReportsDetail())->select(['use_of_reports_detail.*'])
->where('uod_uor_id', $value['uor_id'])
->whereNull('uod_deleted_on')
->get()
->toArray();
};
return $useOfReports;
}
/**
* Function get data use of reports by id.
*
* @return array
*/
public function getById($id): array
{
$useOfReports = $this->select(
[
'use_of_reports.*',
'grp.grp_id',
'grp.grp_name'
]
)->leftJoin('groups AS grp', 'use_of_reports.uor_grp_id', '=', 'grp.grp_id')
->where('uor_id', '=', $id)
->whereNull('grp_deleted_on')
->whereNull('uor_deleted_on')
->get()->toArray();
foreach ($useOfReports as $key => $value) {
$useOfReports[$key]['details'] = (new UseOfReportsDetail())->select(['use_of_reports_detail.*'])
->where('uod_uor_id', $value['uor_id'])
->whereNull('uod_deleted_on')
->get()
->toArray();
};
return $useOfReports;
}
/**
* Function get data use of reports by group id.
*
* @return array
*/
public function getByGroupId($id): array
{
$useOfReports = $this->select(
[
'use_of_reports.*',
'grp.grp_id',
'grp.grp_name'
]
)->leftJoin('groups AS grp', 'use_of_reports.uor_grp_id', '=', 'grp.grp_id')
->where('uor_grp_id', '=', $id)
->whereNull('grp_deleted_on')
->whereNull('uor_deleted_on')
->get()->toArray();
foreach ($useOfReports as $key => $value) {
$useOfReports[$key]['details'] = (new UseOfReportsDetail())->select(['use_of_reports_detail.*'])
->where('uod_uor_id', $value['uor_id'])
->whereNull('uod_deleted_on')
->get()
->toArray();
};
return $useOfReports;
}
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class UseOfReportsDetail extends Model
{
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'uod_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'uod_updated_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'use_of_reports_detail';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'uod_id';
protected $fillable = [
'uod_type',
'uod_uor_id',
'uod_used_on',
'uod_used_by',
'uod_active',
'uod_created_on',
'uod_created_by',
'uod_updated_on',
'uod_updated_by',
'uod_deleted_on',
'uod_deleted_by',
];
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
public $timestamps = false;
/**
* Function get all data use of reports detail.
*
* @return array
*/
public function getAllData(): array
{
$plans = $this
->whereNull('uod_deleted_on');
return $plans->get()->toArray();
}
/**
* Function get all active data use of reports detail.
*
* @return array
*/
public function getAllActiveData(): array
{
$plans = $this->where('uod_active', '=', 'Y')
->whereNull('uod_deleted_on');
return $plans->get()->toArray();
}
/**
* Function get all active data use of reports detail by uor id.
*
* @return array
*/
public function getByUorId($id): array
{
$plans = $this->where('uod_active', '=', 'Y')
->where('uod_uor_id', '=', $id)
->whereNull('uod_deleted_on');
return $plans->get()->toArray();
}
}
<?php
namespace App\Models;
use App\Traits\CreatedFields;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
/**
* Class User
* @package App\Models
*/
class User extends Authenticatable
{
use ScopeModels, CreatedFields, HasApiTokens, HasFactory, Notifiable;
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'us_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'us_updated_on';
/**
* @var string $prefix
*/
public string $prefix = 'us';
/**
* @var string $primaryKey
*/
protected $primaryKey = 'us_id';
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $fillable = [
'us_name', 'us_email', 'us_grp_id', 'us_created_by'
];
/**
* The attributes excluded from the model's JSON form.
*
* @var string[]
*/
protected $hidden = [
'us_password',
];
/**
* Function set relation group model.
*
* @return BelongsTo
*/
public function group()
{
return $this->belongsTo(Group::class, 'us_grp_id', 'grp_id');
}
/**
* Function set relation roles model.
*
* @return HasOne
*/
public function role()
{
return $this->hasOne(UserRoles::class, 'ur_id', 'us_ur_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
/**
* Class UserLogData
* @package App\Models
*/
class UserLogData extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'uld';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'uld_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'uld_updated_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'user_log_data';
/**
* The primary key for the model.
*
* @var string $primaryKey
*/
protected $primaryKey = 'uld_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'uld_us_id',
'uld_action',
'uld_data',
'uld_active',
'uld_created_on',
'uld_created_by',
'uld_updated_on',
'uld_updated_by',
'uld_deleted_on',
'uld_deleted_by',
];
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
/**
* Class UserLogPassword
* @package App\Models
*/
class UserLogPassword extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'ulp';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'ulp_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'ulp_updated_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'user_log_password';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'ulp_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'ulp_us_id',
'ulp_password',
'ulp_active',
'ulp_created_on',
'ulp_created_by',
'ulp_updated_on',
'ulp_updated_by',
'ulp_deleted_on',
'ulp_deleted_by',
];
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
/**
* Class UserRoles
* @package App\Models
*/
class UserRoles extends Model
{
use ScopeModels;
/**
* @var string $prefix
*/
public string $prefix = 'ur';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'ur_created_on';
/**
* The name of the "created at" column.
*
* @var string
*/
const UPDATED_AT = 'ur_update_on';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'user_roles';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'ur_id';
protected $fillable = [
'ur_name',
'ur_code',
'ur_active',
'ur_created_on',
'ur_created_by',
'ur_update_on',
'ur_update_by',
'ur_deleted_on',
'ur_deleted_by',
];
/**
* Function set relation roles model.
*
* @return BelongsTo
*/
public function user()
{
return $this->belongsTo(User::class, 'us_ur_id', 'ur_id');
}
}
<?php
namespace App\Models;
use App\Traits\ScopeModels;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class UserTokens
* @package App\Models
*/
class UserTokens extends Model
{
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'ut_created_on';
/**
* The name of the "update at" column.
*
* @var string
*/
const UPDATED_AT = 'ut_updated_on';
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
public $timestamps = false;
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'user_tokens';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'ut_id';
/**
* @var string[] $fillable
*/
protected $fillable = [
'ut_token',
'ut_type',
'ut_client_ip',
'ut_client_agent',
'ut_us_id',
'ut_remember',
'ut_active',
'ut_created_on',
'ut_expired_on',
'ut_deleted_on'
];
}
<?php
namespace App\Observers;
use Illuminate\Database\Eloquent\Model;
/**
* Class CreatedFieldsObserver
* @package App\Observers
*/
class CreatedFieldsObserver
{
/**
* Handle the User "creating" event.
*
* @param Model $model
*
*/
public function creating(Model $model)
{
$model->{$model->prefix . '_created_by'} = 1;
}
/**
* Handle the User "updating" event.
*
* @param Model $model
*/
public function updating(Model $model)
{
$model->{$model->prefix . '_updated_by'} = 1;
}
}
\ No newline at end of file
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
}
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
}
}
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}
<?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
//
}
/**
* Determine if events and listeners should be automatically discovered.
*
* @return bool
*/
public function shouldDiscoverEvents()
{
return false;
}
}
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to the "home" route for your application.
*
* This is used by Laravel authentication to redirect users after login.
*
* @var string
*/
public const HOME = '/home';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
$this->configureRateLimiting();
$this->routes(function () {
Route::prefix('api')
->middleware('api')
->group(base_path('routes/api.php'));
Route::middleware('web')
->group(base_path('routes/web.php'));
});
}
/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
}
}
<?php
namespace App\Traits;
use Illuminate\Database\Eloquent\Model;
/**
* Class ActionsModels
* @package App\Traits
*/
trait ActionsModels
{
}
\ No newline at end of file
<?php
namespace App\Traits;
use App\Observers\CreatedFieldsObserver;
/**
* Trait CreatedFields
* @package App\Traits
*/
trait CreatedFields
{
public static function bootCreatedFields()
{
static::observe(CreatedFieldsObserver::class);
}
}
\ No newline at end of file
<?php
namespace App\Traits;
use Illuminate\Database\Eloquent\Builder;
/**
* Class TraitModels
* @package App\Traits
*/
trait ScopeModels
{
/**
* @param Builder $query
* @return Builder
*/
public function scopeActive(Builder $query): Builder
{
return $query->where($this->prefix . '_active', '=', 'Y');
}
}
\ No newline at end of file
#!/usr/bin/env php
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any of our classes manually. It's great to relax.
|
*/
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);
/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/
$kernel->terminate($input, $status);
exit($status);
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "8.1.*",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^9.2",
"laravel/sanctum": "^2.14",
"laravel/tinker": "^2.7",
"nuwave/lighthouse": "^5.42"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
This source diff could not be displayed because it is too large. You can view the blob instead.
File added
<?php
use Illuminate\Support\Facades\Facade;
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => Facade::defaultAliases()->merge([
// ...
])->toArray(),
];
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment