tishotm / eloquent-ci-relations Goto Github PK
View Code? Open in Web Editor NEWEloquent Case Insensitive Relations
License: MIT License
Eloquent Case Insensitive Relations
License: MIT License
Any conflicts with Laravel 9?
PS C:\xampp\htdocs\laravel10> composer require tishotm/eloquent-ci-relations
Info from https://repo.packagist.org: #StandWithUkraine
./composer.json has been updated
Running composer update tishotm/eloquent-ci-relations
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- tishotm/eloquent-ci-relations v1.0.0 requires illuminate/database ^5.5.33 || ~6.0 || ~7.0 || ~8.0 -> found illuminate/database[v5.5.33, ..., v5.8.36, v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27] but these were not loaded, likely because it conflicts with another require.
- tishotm/eloquent-ci-relations v1.0.1 requires illuminate/database ^5.5.33 || ^6.20.26 || ~7.0 || ~8.0 -> found illuminate/database[v5.5.33, ..., v5.8.36, v6.20.26, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27] but these were not loaded, likely because it conflicts with another require.
- tishotm/eloquent-ci-relations[v1.0.2, ..., v1.1.0] require illuminate/database ^5.5.33 || ^6.20.26 || ^7.30.4 || ^8.40.0 -> found illuminate/database[v5.5.33, ..., v5.8.36, v6.20.26, ..., v6.20.44, v7.30.4, v7.30.5, v7.30.6, v8.40.0, ..., v8.83.27] but these were not loaded, likely because it conflicts with another require.
- tishotm/eloquent-ci-relations v1.2.0 requires illuminate/database ^5.5.33 || ^6.20.26 || ^7.30.4 || ^8.40.0 || ^9.0 -> found illuminate/database[v5.5.33, ..., v5.8.36, v6.20.26, ..., v6.20.44, v7.30.4, v7.30.5, v7.30.6, v8.40.0, ..., v8.83.27, v9.0.0, ..., v9.52.16] but these were not loaded, likely because it conflicts with another require.
- Root composer.json requires tishotm/eloquent-ci-relations * -> satisfiable by tishotm/eloquent-ci-relations[v1.0.0, ..., v1.2.0].
You can also try re-running composer require with an explicit version constraint, e.g. "composer require tishotm/eloquent-ci-relations:*" to figure out if any version is installable, or "composer require tishotm/eloquent-ci-relations:^2.1" if you know which you need.
Models
use Illuminate\Database\Eloquent\Model;
use TishoTM\Eloquent\Concerns\HasCiRelationships;
class Brand extends Model
{
use HasCiRelationships;
public function sales(){
return $this->hasMany(Sale::class, 'Brand', 'name');
}
class Sale extends Model
{
use HasCiRelationships;
public function brand(){
return $this->belongsTo(Brand::class, 'Brand', 'name');
}
Data
brands table
id, name
1, KIWI
sales table
id, Status, Brand
xx, Fulfilled, Kiwi
xx, Fulfilled, KIWI
Tinker
>>> $kiwi = Brand::where('name','KIWI')->first()
=> App\Models\Brand {#4018
id: 2,
name: "KIWI",
created_at: null,
updated_at: "2019-12-23 22:59:23",
supplier_id: 1,
}
>>> $kiwi->sales()
=> TishoTM\Eloquent\Relations\HasMany {#3983}
>>> $kiwi->sales()->get()->count()
=> 0
$sale = Sale::where('Brand', 'Kiwi')->first()
=> App\Models\Sale {#3931
id: 3994114,
OrderQuantity: 1,
Brand: "Kiwi",
}
>>> $sale->brand
=> null
Laravel 6.18
There are both sales items listed as "KIWI" and "Kiwi" will only pull "KIWI".
Hi and thanks so much for your work!
Do you think you can extend the compatibility to all minor v7.* versions ?
Cheers!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.