本文整理汇总了PHP中Sections::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Sections::all方法的具体用法?PHP Sections::all怎么用?PHP Sections::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sections
的用法示例。
在下文中一共展示了Sections::all方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postCreate
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: function
// 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);