cortex / foundation
The core foundation of Rinvex Cortex modular application architecture.
Installs: 8 013
Dependents: 20
Suggesters: 0
Security: 0
Stars: 7
Watchers: 5
Forks: 5
Type:cortex-module
Requires
- php: ^8.1.0
- appstract/laravel-opcache: ^4.0.0
- barryvdh/laravel-snappy: ^1.0.0
- diglactic/laravel-breadcrumbs: ^8.0.0
- geoip2/geoip2: ^2.11.0
- h4cc/wkhtmltoimage-amd64: ^0.12.0
- h4cc/wkhtmltopdf-amd64: ^0.12.0
- illuminate/broadcasting: ^10.0.0 || ^11.0.0
- illuminate/cache: ^10.0.0 || ^11.0.0
- illuminate/console: ^10.0.0 || ^11.0.0
- illuminate/container: ^10.0.0 || ^11.0.0
- illuminate/contracts: ^10.0.0 || ^11.0.0
- illuminate/database: ^10.0.0 || ^11.0.0
- illuminate/events: ^10.0.0 || ^11.0.0
- illuminate/filesystem: ^10.0.0 || ^11.0.0
- illuminate/http: ^10.0.0 || ^11.0.0
- illuminate/log: ^10.0.0 || ^11.0.0
- illuminate/pagination: ^10.0.0 || ^11.0.0
- illuminate/pipeline: ^10.0.0 || ^11.0.0
- illuminate/queue: ^10.0.0 || ^11.0.0
- illuminate/routing: ^10.0.0 || ^11.0.0
- illuminate/session: ^10.0.0 || ^11.0.0
- illuminate/support: ^10.0.0 || ^11.0.0
- illuminate/translation: ^10.0.0 || ^11.0.0
- illuminate/validation: ^10.0.0 || ^11.0.0
- illuminate/view: ^10.0.0 || ^11.0.0
- laravel/framework: ^10.0.0 || ^11.0.0
- laravelcollective/html: ^6.3.0
- league/fractal: ^0.20.0
- maatwebsite/excel: ^3.1.0
- mariuzzo/laravel-js-localization: ^1.10.0
- mcamara/laravel-localization: ^1.8.0
- proengsoft/laravel-jsvalidation: ^4.8.0
- rinvex/laravel-composer: ^7.0.0
- rinvex/laravel-menus: ^7.0.0
- rinvex/laravel-pages: ^7.0.0
- rinvex/laravel-support: ^7.0.0
- rinvex/laravel-tags: ^7.0.0
- rinvex/tmp-edvinaskrucas-notification: ^5.2.0
- rinvex/tmp-josephsilber-bouncer: ^1.0.0
- rinvex/tmp-lord-laroute: ^2.4.0
- spatie/laravel-activitylog: ^4.7.0
- spatie/laravel-collection-macros: ^7.10.0
- spatie/laravel-medialibrary: ^10.0.0
- symfony/console: ^6.2.0
- symfony/finder: ^6.2.0
- symfony/http-kernel: ^6.2.0
- torann/geoip: ^3.0.0
- vinkla/hashids: ^11.0.0
- yajra/laravel-datatables-buttons: ^10.0.0
- yajra/laravel-datatables-fractal: ^10.0.0
- yajra/laravel-datatables-html: ^10.0.0
- yajra/laravel-datatables-oracle: ^10.4.0
Requires (Dev)
- codedungeon/phpunit-result-printer: ^0.32.0
- phpunit/phpunit: ^10.1.0
- dev-master
- v8.3.6
- v8.3.5
- v8.3.4
- v8.3.3
- v8.3.2
- v8.3.1
- v8.3.0
- v8.2.7
- v8.2.6
- v8.2.5
- v8.2.4
- v8.2.3
- v8.2.2
- v8.2.1
- v8.2.0
- v8.1.1
- v8.1.0
- v8.0.1
- v8.0.0
- v7.3.23
- v7.3.22
- v7.3.21
- v7.3.20
- v7.3.19
- v7.3.18
- v7.3.17
- v7.3.16
- v7.3.15
- v7.3.14
- v7.3.13
- v7.3.12
- v7.3.11
- v7.3.10
- v7.3.9
- v7.3.8
- v7.3.7
- v7.3.6
- v7.3.5
- v7.3.4
- v7.3.3
- v7.3.2
- v7.3.1
- v7.3.0
- v7.2.9
- v7.2.8
- v7.2.7
- v7.2.6
- v7.2.5
- v7.2.4
- v7.2.3
- v7.2.2
- v7.2.1
- v7.2.0
- v7.1.0
- v7.0.0
- v6.0.43
- v6.0.42
- v6.0.41
- v6.0.40
- v6.0.39
- v6.0.38
- v6.0.37
- v6.0.36
- v6.0.35
- v6.0.34
- v6.0.33
- v6.0.32
- v6.0.31
- v6.0.30
- v6.0.29
- v6.0.28
- v6.0.27
- v6.0.26
- v6.0.25
- v6.0.24
- v6.0.23
- v6.0.22
- v6.0.21
- v6.0.20
- v6.0.19
- v6.0.18
- v6.0.17
- v6.0.16
- v6.0.15
- v6.0.14
- v6.0.13
- v6.0.12
- v6.0.11
- v6.0.10
- v6.0.9
- v6.0.8
- v6.0.7
- v6.0.6
- v6.0.5
- v6.0.4
- v6.0.3
- v6.0.2
- v6.0.1
- v6.0.0
- v5.1.14
- v5.1.13
- v5.1.12
- v5.1.11
- v5.1.10
- v5.1.9
- v5.1.8
- v5.1.7
- v5.1.6
- v5.1.5
- v5.1.4
- v5.1.3
- v5.1.2
- v5.1.1
- v5.1.0
- v5.0.2
- v5.0.1
- v5.0.0
- v4.2.0
- v4.1.1
- v4.1.0
- v4.0.9
- v4.0.8
- v4.0.7
- v4.0.6
- v4.0.5
- v4.0.4
- v4.0.3
- v4.0.2
- v4.0.1
- v4.0.0
- v3.1.4
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.2.5
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v0.0.2
- v0.0.1
- dev-develop
This package is auto-updated.
Last update: 2024-08-22 03:23:05 UTC
README
The core foundation of Rinvex Cortex modular application architecture.
Installation and Usage
This package should NOT be installed individually, it's required by rinvex/cortex
and requires a new laravel application instance with special architecture satisfied with Rinvex Cortex.
This package still not yet documented, but you can use it on your own responsibility.
To be documented soon..!
Support Helpers
intend()
The intend
method returns redirect response:
intend([ 'route' => 'route.name.here', 'withErrors' => ['error.message.id' => 'A custom error message'], ]);
Note: this helper accepts
redirect
methods as it's input keys, such aswithErrors
,with
,back
, androute
..etc
unique_with Validator Rule: Usage
Use it like any Validator
rule:
$rules = [ '<field1>' => 'unique_with:<table>,<field2>[,<field3>,...,<ignore_rowid>]', ];
See the Validation documentation of Laravel.
Specify different column names in the database
If your input field names are different from the corresponding database columns, you can specify the column names explicitly.
E.g. your input contains a field 'last_name', but the column in your database is called 'sur_name':
$rules = [ 'first_name' => 'unique_with:users, middle_name, last_name = sur_name', ];
Ignore existing row (useful when updating)
You can also specify a row id to ignore (useful to solve unique constraint when updating)
This will ignore row with id 2:
$rules = [ 'first_name' => 'required|unique_with:users,last_name,2', 'last_name' => 'required', ];
To specify a custom column name for the id, pass it like:
$rules = [ 'first_name' => 'required|unique_with:users,last_name,2 = custom_id_column', 'last_name' => 'required', ];
If your id is not numeric, you can tell the validator:
$rules = [ 'first_name' => 'required|unique_with:users,last_name,ignore:abc123', 'last_name' => 'required', ];
Add additional clauses (e.g. when using soft deletes)
You can also set additional clauses. For example, if your model uses soft deleting then you can use the following code to select all existing rows but marked as deleted
$rules = [ 'first_name' => 'required|unique_with:users,last_name,deleted_at,2 = custom_id_column', 'last_name' => 'required', ];
Soft delete caveat:
In Laravel 5 (tested on 5.5), if the validation is performed in form request class, field deleted_at is skipped, because it's not send in request. To solve this problem, add 'deleted_at' => null to Your validation parameters in request class., e.g.:
protected function validationData() { return array_merge($this->request->all(), [ 'deleted_at' => null ]); }
Specify specific database connection to use
If we have a connection named some-database
, we can enforce this connection (rather than the default) like this:
$rules = [ 'first_name' => 'unique_with:some-database.users, middle_name, last_name', ];
E.g. pretend you have a users
table in your database plus User
model like this:
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateUsersTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('users', function(Blueprint $table) { $table->increments('id'); $table->timestamps(); $table->string('first_name'); $table->string('last_name'); $table->unique(['first_name', 'last_name']); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('users'); } }
<?php class User extends Eloquent { }
Now you can validate a given first_name
, last_name
combination with something like this:
Route::post('test', function() { $rules = [ 'first_name' => 'required|unique_with:users,last_name', 'last_name' => 'required', ]; $validator = Validator::make(Input::all(), $rules); if($validator->fails()) { return Redirect::back()->withErrors($validator); } $user = new User; $user->first_name = Input::get('first_name'); $user->last_name = Input::get('last_name'); $user->save(); return Redirect::route('home')->with('success', 'User created!'); });
Changelog
Refer to the Changelog for a full history of the project.
Support
The following support channels are available at your fingertips:
Contributing & Protocols
Thank you for considering contributing to this project! The contribution guide can be found in CONTRIBUTING.md.
Bug reports, feature requests, and pull requests are very welcome.
Security Vulnerabilities
If you discover a security vulnerability within this project, please send an e-mail to help@rinvex.com. All security vulnerabilities will be promptly addressed.
About Rinvex
Rinvex is a software solutions startup, specialized in integrated enterprise solutions for SMEs established in Alexandria, Egypt since June 2016. We believe that our drive The Value, The Reach, and The Impact is what differentiates us and unleash the endless possibilities of our philosophy through the power of software. We like to call it Innovation At The Speed Of Life. That’s how we do our share of advancing humanity.
License
This software is released under The MIT License (MIT).
(c) 2016-2022 Rinvex LLC, Some rights reserved.