public function delete($lang, $id)
    {
        if(!User::hasAccess('Language', 'delete')) {
            return $this->noPermission();
        }
        $language = Language::find($id);

        if($language) {
            if ($language->isDefault) {
                return $this->response("You can't delete the default language!", 403);
            }

            if($language->delete()) {
                // create virutal column for slug of every post type in the created language
                $allPostTypes = PostType::all();
                foreach ($allPostTypes as $postType){
                    AccioQuery::deleteColumn($postType->slug, "slug_".$language->slug);
                }

                $this->deleteDirectory($language->slug);
                return $this->response('The Language was deleted');
            }
        }

        return $this->response('The Language was not deleted. Please try again later', 500);
    }
public function delete($lang, $id)
    {
        if(!User::hasAccess('Language', 'delete')) {
            return $this->noPermission();
        }
        $language = Language::find($id);

        if($language) {
            if ($language->isDefault) {
                return $this->response("You can't delete the default language!", 403);
            }

            if($language->delete()) {
                // create virutal column for slug of every post type in the created language
                $allPostTypes = PostType::all();
                foreach ($allPostTypes as $postType){
                    AccioQuery::deleteColumn($postType->slug, "slug_".$language->slug);
                }

                $this->deleteDirectory($language->slug);
                return $this->response('The Language was deleted');
            }
        }

        return $this->response('The Language was not deleted. Please try again later', 500);
    }
public function delete ( $ lang , $ id ) { if ( ! User :: hasAccess ( 'Language' , 'delete' ) ) { return $ this -> noPermission ( ) ; } $ language = Language :: find ( $ id ) ; if ( $ language ) { if ( $ language -> isDefault ) { return $ this -> response ( "You can't delete the default language!" , 403 ) ; } if ( $ language -> delete ( ) ) { // create virutal column for slug of every post type in the created language $ allPostTypes = PostType :: all ( ) ; foreach ( $ allPostTypes as $ postType ) { AccioQuery :: deleteColumn ( $ postType -> slug , "slug_" . $ language -> slug ) ; } $ this -> deleteDirectory ( $ language -> slug ) ; return $ this -> response ( 'The Language was deleted' ) ; } } return $ this -> response ( 'The Language was not deleted. Please try again later' , 500 ) ; }
Delete language.
Removes language directory used for labels.

@param  string $lang
@param  int    $id
@return array
Delete language . Removes language directory used for labels .