本文整理汇总了PHP中group::save方法的典型用法代码示例。如果您正苦于以下问题:PHP group::save方法的具体用法?PHP group::save怎么用?PHP group::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类group
的用法示例。
在下文中一共展示了group::save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
$group = new group();
$group->name = $request->input('name');
$group->body = $request->input('body');
$group->group_type = $request->input('group_type');
if ($request->get('address')) {
$group->address = $request->input('address');
if (!$group->geocode()) {
flash()->error(trans('messages.address_cannot_be_geocoded'));
} else {
flash()->info(trans('messages.ressource_geocoded_successfully'));
}
}
if ($group->isInvalid()) {
// Oops.
return redirect()->action('GroupController@create')->withErrors($group->getErrors())->withInput();
}
$group->save();
// handle cover
if ($request->hasFile('cover')) {
Storage::disk('local')->makeDirectory('groups/' . $group->id);
Image::make($request->file('cover'))->widen(800)->save(storage_path() . '/app/groups/' . $group->id . '/cover.jpg');
Image::make($request->file('cover'))->fit(300, 200)->save(storage_path() . '/app/groups/' . $group->id . '/thumbnail.jpg');
}
// make the current user a member of the group
$membership = \App\Membership::firstOrNew(['user_id' => $request->user()->id, 'group_id' => $group->id]);
$membership->notification_interval = 60 * 24;
// default to daily interval
$membership->membership = \App\Membership::MEMBER;
$membership->save();
return redirect()->action('MembershipController@settings', [$group->id]);
}
示例2: check_and_save
public static function check_and_save($session_id, $group_id, $group_name)
{
$session = session::get_session($session_id);
if ($session != null && $session->is_valid()) {
$user = ormlib::get_from_instance(new user(), array("id"), array($session->user_id));
if ($user->has_group(session::GROUP_METADATA) === true) {
if ($group_name != "") {
group::save($group_id, $group_name);
return array("response" => "OK");
} else {
return array("response" => "error", "message" => "name is empty");
}
}
}
return array("response" => "error", "message" => "no privileg");
}
示例3: group
* This file is part of Infoschool - a web based school intranet.
* Copyright (C) 2004 Maikel Linke
*/
include 'var.php';
$output->secure();
$group = new group();
if (isset($_GET['id'])) {
$group->data['id'] = (int) $_GET['id'];
}
$nogroup = !$group->load();
if ($nogroup) {
$output->title[] = 'own groups';
$output->headline[] = 'own groups';
$select = 'id, name from gruppe where leiter="' . $_SESSION['userid'] . '" order by name';
$db->select($select);
$v['group'] = $db->data;
$content = new tmpl('own_groups.html', $v);
} else {
if ($group->is_head()) {
if (isset($_POST['data'])) {
$group->save($_POST['data']);
$group->load();
}
$group->format();
$content = new tmpl('group_mod.html', $group->fdata);
} else {
$group->format();
$content = new tmpl('group.html', $group->fdata);
}
}
$output->out($content);