Delete and Observables
See original GitHub issueDelete has the following trait (https://github.com/Laravel-Backpack/CRUD/blob/master/src/PanelTraits/Delete.php):
/**
* Delete a row from the database.
*
* @param [int] The id of the item to be deleted.
* @param int $id
*
* @return [bool] Deletion confirmation.
*
* TODO: should this delete items with relations to it too?
*/
public function delete($id)
{
return (string) $this->model->find($id)->delete();
}
If one forces that (string) cast out to make this an actual PHP bool (i.e. true
&& false
) then the AJAX table always figures there is an issue.
I would note that Laravel’s Eloquent returns false if an observable returns false, e.g:
(Illuminate\Database\Eloquent\Model - Laravel:~5.4)
616 /**
617 * Perform a model insert operation.
618 *
619 * @param \Illuminate\Database\Eloquent\Builder $query
620 * @return bool
621 */
622 protected function performInsert(Builder $query)
623 {
624 if ($this->fireModelEvent('creating') === false) {
625 return false;
626 }
Might it be better to return whatever the underlying create
operation returned rather than cast it to a string?
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Subject and Observable, how to delete item, filter() list and next()
I have a list of songs setup with Subject and Observable (shown with | async in view), and now I want to delete...
Read more >Deleting Your Account - Observable
You can delete your Observable account from your Settings page: Click Settings on your Home page to begin the process of account deletion....
Read more >How to clean-up Observables in Angular - Medium
Here is a good pattern to effectively remove all Observables from memory in an Angular application once they are no longer needed.
Read more >[Bug] Can't delete Observables via API #2377 - GitHub
It is not possible to delete observables via the API. The observables can easily be found in the database (either from the Observable...
Read more >How to delete record in grids using Observables method
Hi, I can both insert and update a record in grids into the server but can not delete any record. I have read...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@tumf87 - I’m not sure we disagree with each other (and in fact, one just substitutes
whatever
in the variousreturn response(...)
to boot).I should turn it into a PR I suppose.
Ok, this just got noticed again - reopening.