electricjones / eloquent-meta Goto Github PK
View Code? Open in Web Editor NEWAttach metadata to Eloquent models
License: MIT License
Attach metadata to Eloquent models
License: MIT License
Finally, run the migration php artisan migrate --package="phoenix/eloquentmeta" to create the database table.
Should be:
Finally, run the migration php artisan migrate --package="phoenix/eloquent-meta" to create the database table.
Non-laravel users can currently use the package, but not any of the command-line utilities. This should either be described in the docs or a more general command created.
It would be good to release a new package to packagist :)
When storing a string that contains a string like "01.01.1970", the maybeDecode() function returns only the first two sequences, since json_decode() returns no error. The function should also check if the result of json_decode() is an object.
I created an Unique Meta Model and Table for my Items model.
I can migrate the models with no problem but when I try to migrate:rollback / migrate:reset I get the next error:
Class 'CreateItemMetaTable' not found.
It ain't fixed with composer dump-autoload, any idea how to fix this?
This is a running list of items that need to be addressed for the upcoming Laravel 5.0 release
Following error displays on updatedMeta function.
Type error: Argument 1 passed to Illuminate\Validation\Factory::__construct() must implement interface Illuminate\Contracts\Translation\Translator, instance of Symfony\Component\Translation\Translator given, called in C:\xampp\htdocs\v2.superdash.ca\vendor\phoenix\eloquent-meta\src\Phoenix\EloquentMeta\Meta.php on line 77
Any advice towards resolution?
Does the current release allow nested set of meta data? Or do you plan to release a version with a nested meta data set? It could be useful in a lot of cases, so I am wondering if you are planning to develop this. Thanks!
I ran across an issue while trying to json_encode()
a Model, that used the MetaTrait
and included the meta-information in the json. See my StackOverflow question.
Whether the inclusion is done by loading the model ::with("meta")
, or by adding the meta-data to the toArray()
-method of the model (as I did in the question) doesn't madder.
The json_encode()
-function returns false
, the json_last_error()
-method returns JSON_ERROR_SYNTAX
and the json_last_error_msg()
-method returns Syntax error
(which is weird, since that error can't come up when encoding... trust me, I read the sources...).
Also, Laravel throws the following error (it tries to return the false
generated by json_encode
):
UnexpectedValueException in Response.php line 403: The Response content must be a string or object implementing __toString(), "boolean" given.
After some testing I found that when I call json_encode($data, JSON_PARTIAL_OUTPUT_ON_ERROR)
, the returned JSON is complete and valid, which baffled me even more.
I traced the error back to the Helpers.maybeDecode($value)
-method:
The current implementation tries to parse the value with json_decode($value)
and checks, whether that worked, by checking the json_last_error()
-function. The problem is, that this doesn't reset the last error.
When the Helpers.maybeDecode($value)
-method is called, while Laravel is encoding the model, and the value it tried to decode was not an valid json (for example, a simple string), the error code is set, causing the json_encode()
-function to see it and return null
. The problem is with the global nature of the error-variable.
My proposed workaround for this is to reset the json_last_error()
-function after checking if decoing worked, and the only way I have found to do this is by decoding something valid (even if it's just an empty array).
I'm going to send a pull-request soon.
Let me know if further information is required!
Laravel 5.5 just came out, was testing my app and when running composer update came across this:
Problem 2
- phoenix/eloquent-meta v1.6.2 requires illuminate/validation 5.4.* -> satisfiable by laravel/framework[v5.4.35], illuminate/validation[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9].
- phoenix/eloquent-meta v1.6.1 requires illuminate/translation 5.4.* -> satisfiable by laravel/framework[v5.4.35], illuminate/translation[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9].
- phoenix/eloquent-meta v1.6.2 requires illuminate/translation 5.4.* -> satisfiable by laravel/framework[v5.4.35], illuminate/translation[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9].
- Can only install one of: laravel/framework[v5.5.0, v5.4.35].```
Hi.
Is it possible to remove columns such as metable_id and metable_type during getAllMeta() call? Because I have been trying to return the meta data using a model accessor like so:
protected $appends = ['meta_data'];
....
public function getMetaDataAttribute(){
return $this->getAllMeta();
}
but unfortunately, the metable_id and metable_type is also included, which is totally unnecessary and may be insecure (for some reason).
Sorry for bumping a not-so-updated repo, I like this repo due to stability.
Thanks!
Jan
template file is currently hard coded in migrations
$template_file = '2013_07_01_180252_create_meta_table.php';
should be updated to the new file
2014_08_15_180252_create_meta_table.php
Hi
how i can find all user who have same meta ?
thx
@electricjones packgist stills on v.1.8.0 :(
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.