question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Delete and Observables

See original GitHub issue

Delete 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:closed
  • Created 6 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
lloy0076commented, Sep 4, 2017

@tumf87 - I’m not sure we disagree with each other (and in fact, one just substitutes whatever in the various return response(...) to boot).

I should turn it into a PR I suppose.

1reaction
lloy0076commented, Feb 23, 2018

Ok, this just got noticed again - reopening.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found