本文整理匯總了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);