![]() ![]() Like the persists the model, so there's no need to call Illuminate\Database\Eloquent\SoftDeletes trait on the model and add the interface. The better business case for a PR like this is if it also enables the end users to write slightly better and faster code than what is already provided by the sql like methods. You will need to call manually to persist it: method to do this in one step. Eloquent understands any of the types defined in the castAttribute() function, which as of Laravel 5. I would therefore understand why someone would avoid these except methods for performance reason. The Laravel find() method can return single or. To me this is highly inefficient as it will take 2 queries to do a job that would have otherwise been done by one query and provided better performance. The Laravel find method is a useful way of retrieving records from the database using the primary key. Calling ->except() on some task inside that route will require me to query the user model first with the current id and then pass it to the except method which will do another query. When invoking the user method, Eloquent will attempt to find a User model that has an id which matches the userid column on the Phone model. Why? Because if it requires an instance of a model, and we are on an update route like update/user/id. Well if the User can only be associated with one company, then your relationship should reflect this. ![]() It could therefore be documented that except() always expects the arguments to be the primary keys of the model which should be the instance of an int. I think the way to make this better would be to remove the restriction that the method arguments have to be the instance of an eloquent model. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |