public function delete(EntityContract $entity)
    {
        $result = new Result();

        $result->addErrors($this->authorizer->authorize(Tokens::PERMISSION_REMOVE, $entity, Bag::factory([])));

        if (!$result->ok()) {
            return $result;
        }

        try {
            DB::beginTransaction();
            $entity->delete();
            DB::commit();
        } catch (Exception $e) {
            DB::rollBack();

            throw $e;
        }

        return $result;
    }
public function delete(EntityContract $entity)
    {
        $result = new Result();

        $result->addErrors($this->authorizer->authorize(Tokens::PERMISSION_REMOVE, $entity, Bag::factory([])));

        if (!$result->ok()) {
            return $result;
        }

        try {
            DB::beginTransaction();
            $entity->delete();
            DB::commit();
        } catch (Exception $e) {
            DB::rollBack();

            throw $e;
        }

        return $result;
    }
public function delete ( EntityContract $ entity ) { $ result = new Result ( ) ; $ result -> addErrors ( $ this -> authorizer -> authorize ( Tokens :: PERMISSION_REMOVE , $ entity , Bag :: factory ( [ ] ) ) ) ; if ( ! $ result -> ok ( ) ) { return $ result ; } try { DB :: beginTransaction ( ) ; $ entity -> delete ( ) ; DB :: commit ( ) ; } catch ( Exception $ e ) { DB :: rollBack ( ) ; throw $ e ; } return $ result ; }
Delete a EntityContract.

@param \Railken\Lem\Contracts\EntityContract $entity

@return ResultContract
Delete a EntityContract .