本文整理汇总了PHP中app\Page::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::save方法的具体用法?PHP Page::save怎么用?PHP Page::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Page
的用法示例。
在下文中一共展示了Page::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param PageRequest|Request $request
* @param Project $project
* @param Module $module
* @param Page $page
* @return \Illuminate\Http\Response
*/
public function update(PageRequest $request, Project $project, Module $module, Page $page)
{
if (isset($_POST['module_id'])) {
$module_id = $_POST['module_id'];
$pages = Page::where('module_id', '=', $module_id)->get();
foreach ($pages as $page) {
$page->update($request->all());
$page->save();
}
return redirect()->route('project.module.show', [$project, $module]);
}
if (isset($_POST['module_name'])) {
$pages = $_POST;
$module = Module::where('project_id', '=', $project->id)->where('name', '=', $_POST['module_name'])->first();
foreach ($pages as $val) {
if (is_numeric($val)) {
$p = Page::where('id', '=', $val)->first();
$p->module_id = $module->id;
$p->save();
}
}
}
$page->update($request->all());
$page->save();
return redirect()->route('project.module.show', [$project, $module]);
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
$this->validate($request, ['title' => 'required|unique:pages|max:255', 'body' => 'required']);
$page = new Page();
$page->title = Input::get('title');
$page->body = Input::get('body');
$page->user_id = 1;
//Auth::user()->id;
if ($request->ajax()) {
if ($page->save()) {
return Response::json(array('success' => true, 'type' => 'create'));
} else {
return Response::json(array('success' => false, 'type' => 'create'));
}
} else {
if ($page->save()) {
return Redirect::to('admin');
} else {
return Redirect::back()->withInput()->withErrors('保存失败!');
}
}
/* Page::create(array(
'title' => Input::get('title'),
'body' => Input::get('body')
));
return Resoponse::json(array('success' => true));*/
}
示例3: postSimpan
public function postSimpan(Request $request)
{
$this->validate($request, ['judul' => 'required|unique:site_pages|min:3', 'konten' => 'required']);
$slug = str_slug($request->judul, "-");
if ($request->hasFile('gambar')) {
if ($request->file('gambar')->isValid()) {
$ext = $request->file('gambar')->getClientOriginalExtension();
$nm_gambar = str_limit($slug, 30);
$nm_gambar = rand(11111, 99999) . "-" . $nm_gambar . "." . $ext;
$request->file('gambar')->move(base_path() . "/resources/assets/img/page/", $nm_gambar);
} else {
return redirect()->route('page_tambah');
}
} else {
$nm_gambar = "";
}
// Simpan Page
$Page = new Page();
$Page->judul = $request->judul;
$Page->slug = $slug;
$Page->konten = $request->konten;
$Page->gambar = $nm_gambar;
$Page->draft = $request->draft;
$Page->id_user = $this->User->id;
$Page->save();
$id = $Page->id;
$request->session()->flash('success', 'Berhasil menyimpan data');
return redirect()->route('page_edit', [$id]);
}
示例4: moduleAndPageCreate
public function moduleAndPageCreate($request)
{
$projectID = Project::orderBy('id', 'desc')->first();
$modules = $request->projected_total_modules;
$m = 1;
$pages = $request->projected_total_pages / $request->projected_total_modules;
$p = 1;
$pageNumber = 1;
while ($m <= $modules) {
$newModule = new Module();
$newModule->project_id = $projectID->id;
$newModule->name = 'Modulo' . $m;
$newModule->projected_total_pages = $pages;
$newModule->save();
$p = 1;
while ($p <= $pages) {
$moduleID = Module::orderBy('id', 'desc')->first();
$newPage = new Page();
$newPage->module_id = $moduleID->id;
$newPage->name = $pageNumber;
$newPage->save();
$p++;
$pageNumber++;
}
$m++;
}
}
示例5: store
public function store(Request $request)
{
$datos = $request->only('domain', 'page');
$checkUrl = true;
// by default will look for the url if exist
//check if the domain exist
$dominio = Domain::where('domain', $datos['domain'])->first();
if (!$dominio) {
$dominio = new Domain();
$dominio->domain = $datos['domain'];
$dominio->save();
$checkUrl = false;
//if the domain doesnt exist, then neither the page so i will skip the search
}
if ($checkUrl) {
$page = Page::where('url', $datos['page'])->first();
if ($page) {
return response()->json(Page::where('domain_id', $dominio->id)->get());
}
}
$user = $request->user();
$newpage = new Page();
$newpage->domain_id = $dominio->id;
$newpage->url = $datos['page'];
$newpage->created_by = $user->id;
$newpage->save();
return response()->json(Page::where('domain_id', $dominio->id)->get());
}
示例6: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
$validator = Validator::make($request->all(), ['title' => 'required|min:5|max:60|unique:pages']);
if ($validator->fails()) {
return redirect()->back()->withErrors($validator)->withInput();
}
$page = new Page();
if ($request->sort_id > 0) {
$page->sort_id = $request->sort_id;
} else {
$page->sort_id = $page->increment('sort_id', 1);
}
$page->title = $request->title;
$page->slug = !empty($request->slug) ? $request->slug : str_slug($request->title);
$page->meta_title = $request->meta_title;
$page->meta_description = $request->meta_description;
$page->text = $request->text;
$page->lang = $request->lang;
if ($request->status == 'on') {
$page->status = 1;
} else {
$page->status = 0;
}
$page->save();
return redirect('/admin/pages')->with('status', 'Страница добавлена!');
}
示例7: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Page $page
*
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Page $page)
{
$this->authorize($page->permission);
$page->body = $request->body;
$page->updated_by = $request->user()->id;
$page->save();
return redirect()->route($page->name)->with('status', 'Siden ble lagret.');
}
示例8: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
$page = new Page();
$page->name = $request->name;
$page->content = $request->content;
$page->save();
return redirect()->action('PageController@create')->with('status', 'Page Saved!');
}
示例9: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(PageRequest $request)
{
$page = new Page($request->all());
$page->created_by = Auth::user()->id;
$page->modified_by = Auth::user()->id;
$page->save();
flash()->success('Page Created');
return redirect('pages');
}
示例10: create
public function create($data)
{
$page = new Page($data);
if (!$data['parent_id']) {
$page->parent_id = null;
}
$page->save();
return $page;
}
示例11: update
public function update(PageCreateRequest $request, Page $page)
{
$page->name = $request->get("name");
$page->content = $request->get("content");
$page->parent_id = $request->get("parent_id") == 0 ? null : $request->get("parent_id");
$page->is_menu = $request->has("is_menu") ? true : false;
$page->is_footer = $request->has("is_footer") ? true : false;
$page->save();
return redirect()->route("admin.page.edit", $page->id)->with("success", trans("realestateadmin::page.edited"));
}
示例12: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$page = new Page();
$page->name = $request->name;
$page->slug = $request->slug;
$page->content = $request->Description;
$page->save();
Activity::log('Added a new page, ' . $page->name);
$request->session()->flash('status', 'Page was added.');
return Redirect::action('PagesController@index');
}
示例13: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
$this->validate($request, ['title' => 'required|unique:pages|max:255', 'body' => 'required']);
$page = new Page();
$page->title = Input::get('title');
$page->body = Input::get('body');
if ($page->save()) {
return Redirect::to('admin');
} else {
return Redirect::back()->withInput()->withErrors('保存失败');
}
}
示例14: edit
public function edit()
{
$page = Page::where('slug', 'oshu')->first();
if ($page == null) {
$new = new Page();
$new->slug = 'oshu';
$new->nav_title = 'OSHU - Wat doen we?';
$new->title = 'test';
$new->body = 'test';
$new->save();
}
$page = Page::where('slug', 'oshu')->first();
return view('pages.admin.pages.edit', compact('page'));
}
示例15: oshu
public function oshu()
{
$page = Page::where('slug', 'oshu')->first();
if ($page == null) {
$new = new Page();
$new->slug = 'oshu';
$new->nav_title = 'OSHU - Wat doen we?';
$new->title = 'test';
$new->body = 'test';
$new->save();
}
$page = Page::where('slug', 'oshu')->first();
$examples = Example::all();
return view('pages.public.oshu', compact('page', 'examples'));
}