コード例 #1
0
ファイル: SectionController.php プロジェクト: nagyist/abge
 public function postCreate()
 {
     $all = Sections::all();
     $section = new Sections();
     $section->title = Input::get('title');
     $section->description = Input::get('description');
     $section->type = 'section';
     $section->status = 'draft';
     $section->order = count($all) + 1;
     $section->file = Input::get('file') == 'true' ? true : false;
     if ($section->save()) {
         return Redirect::to($this->route)->with('msg_success', Lang::get('messages.sections_create', array('title' => $section->title, 'description' => $section->description, 'file' => $section->file)));
     } else {
         return Redirect::to($this->route)->with('msg_error', Lang::get('messages.sections_create_err', array('title' => $section->title, 'description' => $section->description, 'file' => $section->file)));
     }
 }
コード例 #2
0
    //  return $page_values->page_url;
    return View::make('editSection')->with(['section_values' => $section_values]);
});
Route::get('/delete', function () {
    $page_values = Pages::where('id', '=', Input::get('id'))->first();
    DB::table('pages')->where('id', '=', Input::get('id'))->delete();
    $pages = Pages::all();
    if (File::exists($page_values->page_url)) {
        File::delete($page_values->page_url);
    }
    return View::make('table')->with(['message' => "Page deleted successfully", 'pages' => $pages]);
});
Route::get('/deleteSection', function () {
    $page_values = Sections::where('id', '=', Input::get('id'))->first();
    DB::table('sections')->where('id', '=', Input::get('id'))->delete();
    $sections = Sections::all();
    if (File::exists($page_values->section_url)) {
        File::deleteDirectory($page_values->section_url);
    }
    return View::make('upload')->with(['message' => "Section deleted successfully", 'sections' => $sections]);
});
Route::get('/section', function () {
    return View::make('sections');
});
Route::post('addSection', function () {
    $sections = Sections::where('name_of_section', '=', Input::get('name_of_section'))->first();
    $path = public_path() . '\\' . 'sections\\' . Input::get('shortname');
    $section = ['name_of_section' => Input::get('name_of_section'), 'sub_section' => Input::get('sub_section'), 'shortname' => Input::get('shortname'), 'section_url' => $path];
    $sections = ['name_of_section' => Input::get('name_of_section'), 'sub_section' => Input::get('sub_section'), 'shortname' => Input::get('shortname')];
    $rule = array('name_of_section' => 'required', 'shortname' => 'required');
    $validator = Validator::make($sections, $rule);