public static function deleteItem($id) { $item = ActeLocaleModel::find($id); if ($item) { $item->delete(); Files::dropMultiple(ActeLocaleModel::$filesModule, $id); } }
public function postDelete() { $id = Input::get('id'); $post = Post::find($id); if ($post->is_trash == 1) { PostLang::where('post_id', $id)->delete(); FeedFieldValue::where('post_id', $id)->delete(); Files::dropMultiple('post_cover', $id); Files::dropMultiple('doc_post_lang', $id); Files::dropMultiple('doc_post', $id); $post->delete(); Log::warning("Drop post #{$id}"); } return Redirect::to('feed'); }
public function getEmpty() { return ['no no no']; // BAD EMPTY FUNCTION // delete posts $posts = Post::where('taxonomy_id', 2)->get(); foreach ($posts as $post) { PostLang::where('post_id', $post->id)->delete(); Files::dropMultiple('post_cover', $post->id); Files::dropMultiple('doc_post', $post->id); Files::dropMultiple('doc_post_lang', $post->id); $post->delete(); } DB::table('apl_feed_field_value')->truncate(); DB::table('apl_feed_post')->truncate(); DB::table(PostLang::getTableName())->update(array('text' => '')); // delete acte $actes = DB::table('apl_acte')->get(); foreach ($actes as $act) { Files::dropMultiple('actelocale', $act->id); } DB::table('apl_acte')->truncate(); // calendar DB::table('apl_calendar_group')->truncate(); DB::table('apl_calendar_item')->truncate(); DB::table('apl_calendar_item_lang')->truncate(); DB::table('apl_calendar_post')->truncate(); // complaint DB::table('apl_complaint')->truncate(); // firechat DB::table('apl_firechat')->truncate(); // gallery $galls = DB::table('apl_gallery')->get(); foreach ($galls as $gal) { Files::dropMultiple('gallery', $gal->id); } DB::table('apl_gallery')->truncate(); DB::table('apl_gallery_post')->truncate(); // reqs $reqs = DB::table('apl_job_requests')->get(); foreach ($reqs as $req) { if ($req->cv_path && file_exists($_SERVER['DOCUMENT_ROOT'] . '/' . $req->cv_path)) { @unlink($_SERVER['DOCUMENT_ROOT'] . '/' . $req->cv_path); } } DB::table('apl_job_requests')->truncate(); // logs DB::table('apl_logs')->truncate(); // newsletter DB::table('apl_newsletter')->truncate(); // persons $persons = DB::table('apl_person')->get(); foreach ($persons as $person) { Files::dropMultiple('person', $person->id); Files::dropMultiple('person_chat', $person->id); } DB::table('apl_person_audience')->truncate(); DB::table('apl_person')->truncate(); DB::table('apl_person_lang')->truncate(); DB::table('apl_person_rel')->truncate(); // polls DB::table('apl_poll')->truncate(); DB::table('apl_poll_answer')->truncate(); DB::table('apl_poll_answer_lang')->truncate(); DB::table('apl_poll_question')->truncate(); DB::table('apl_poll_votes')->truncate(); // pagefiles $pagefiles = DB::table('apl_file')->where('module_name', 'article_cover')->get(); foreach ($pagefiles as $pf) { Files::drop($pf->id); } DB::table('apl_file')->where('module_name', 'page')->delete(); // othfiles $files = DB::table('apl_file')->where('module_name', 'article_cover')->get(); foreach ($files as $file) { Files::drop($file->id); } DB::table('apl_file')->where('module_name', 'article_cover')->delete(); $files = DB::table('apl_file')->where('module_name', 'doc_post_lang')->get(); foreach ($files as $file) { Files::drop($file->id); } DB::table('apl_file')->where('module_name', 'doc_post_lang')->delete(); $files = DB::table('apl_file')->where('module_name', 'test')->get(); foreach ($files as $file) { Files::drop($file->id); } DB::table('apl_file')->where('module_name', 'test')->delete(); $files = DB::table('apl_file')->where('module_name', 'person')->get(); foreach ($files as $file) { Files::drop($file->id); } DB::table('apl_file')->where('module_name', 'person')->delete(); $files = DB::table('apl_file')->where('module_name', 'rewwe')->get(); foreach ($files as $file) { Files::drop($file->id); } DB::table('apl_file')->where('module_name', 'rewwe')->delete(); return ['executed']; }
public function deleteperson() { $id = Input::get('id'); \PersonModel::where('id', $id)->delete(); \PersonLangModel::where('person_id', $id)->delete(); \Files::dropMultiple('person', $id); \Files::dropMultiple('person_chat', $id); \PersonRelModel::where('person_id', $id)->delete(); return \Illuminate\Support\Facades\Redirect::to('person/list'); }