src/Http/Controllers/MessageResourceController.php
public function destroy(MessageRequest $request, Message $message)
    {
        try {

            if (!empty($request->get('arrayIds'))) {
                $ids = $request->get('arrayIds');
                $t   = $this->repository->deleteMultiple($ids);
                return $t;
            } else {
                $t = $message->delete();
            }

            $this->repository->pushCriteria(new \Litepie\Message\Repositories\Criteria\MessageAdminCriteria());
            $inbox_count = $this->repository->msgCount('Inbox');
            $trash_count = $this->repository->msgCount('Trash');

            return response()->json([
                'message'     => trans('messages.success.deleted', ['Module' => trans('message::message.name')]),
                'code'        => 202,
                'redirect'    => trans_url('/admin/message/message/0'),
                'inbox_count' => $inbox_count,
                'trash_count' => $trash_count,
            ], 202);

        } catch (Exception $e) {

            return response()->json([
                'message'  => $e->getMessage(),
                'code'     => 400,
                'redirect' => trans_url('/admin/message/message/' . $message->getRouteKey()),
            ], 400);
        }

    }
public function destroy(MessageRequest $request, Message $message)
    {
        try {

            if (!empty($request->get('arrayIds'))) {
                $ids = $request->get('arrayIds');
                $t   = $this->repository->deleteMultiple($ids);
                return $t;
            } else {
                $t = $message->delete();
            }

            $this->repository->pushCriteria(new \Litepie\Message\Repositories\Criteria\MessageAdminCriteria());
            $inbox_count = $this->repository->msgCount('Inbox');
            $trash_count = $this->repository->msgCount('Trash');

            return response()->json([
                'message'     => trans('messages.success.deleted', ['Module' => trans('message::message.name')]),
                'code'        => 202,
                'redirect'    => trans_url('/admin/message/message/0'),
                'inbox_count' => $inbox_count,
                'trash_count' => $trash_count,
            ], 202);

        } catch (Exception $e) {

            return response()->json([
                'message'  => $e->getMessage(),
                'code'     => 400,
                'redirect' => trans_url('/admin/message/message/' . $message->getRouteKey()),
            ], 400);
        }

    }
public function destroy ( MessageRequest $ request , Message $ message ) { try { if ( ! empty ( $ request -> get ( 'arrayIds' ) ) ) { $ ids = $ request -> get ( 'arrayIds' ) ; $ t = $ this -> repository -> deleteMultiple ( $ ids ) ; return $ t ; } else { $ t = $ message -> delete ( ) ; } $ this -> repository -> pushCriteria ( new \ Litepie \ Message \ Repositories \ Criteria \ MessageAdminCriteria ( ) ) ; $ inbox_count = $ this -> repository -> msgCount ( 'Inbox' ) ; $ trash_count = $ this -> repository -> msgCount ( 'Trash' ) ; return response ( ) -> json ( [ 'message' => trans ( 'messages.success.deleted' , [ 'Module' => trans ( 'message::message.name' ) ] ) , 'code' => 202 , 'redirect' => trans_url ( '/admin/message/message/0' ) , 'inbox_count' => $ inbox_count , 'trash_count' => $ trash_count , ] , 202 ) ; } catch ( Exception $ e ) { return response ( ) -> json ( [ 'message' => $ e -> getMessage ( ) , 'code' => 400 , 'redirect' => trans_url ( '/admin/message/message/' . $ message -> getRouteKey ( ) ) , ] , 400 ) ; } }
Remove the message.

@param Model   $message

@return Response
Remove the message .