本文整理汇总了PHP中App\Http\Controllers\Log::add_log方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::add_log方法的具体用法?PHP Log::add_log怎么用?PHP Log::add_log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Http\Controllers\Log
的用法示例。
在下文中一共展示了Log::add_log方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Log
function logout_all()
{
$log = new Log();
$id = $_SESSION['user_login_id'];
$sql = "UPDATE `user_login` SET `user_logout_time` = SYSDATE() , `user_login_status` = '0' WHERE `id` = '{$id}' ";
DB::update(DB::raw($sql));
$log->add_log(" ", " ", "User Logout");
// add a log
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
session_start();
$data = $request->all();
$count = App\User::where('user_name', $data['user_name'])->count();
if ($count != 0) {
return 0;
} else {
$data['user_owner'] = $_SESSION['user_id'];
$data['user_password'] = md5($data['user_password']);
$userid = App\User::create($data)->id;
$log = new Log();
$log->add_log("users", $userid, "insert");
// add a log
foreach ($_SESSION['groups'] as $group_name) {
$group_d = App\group::where('group_name', $group_name)->first();
$group_pri = App\privilege::where('group_id', $group_d->group_id)->first();
$data_pri = ['user_id' => $userid, 'group_id' => $group_d->group_id, 'call_log' => $group_pri->call_log, 'contact' => $group_pri->contact, 'account' => $group_pri->account, 'user' => $group_pri->user, 'group' => $group_pri->group, 'sales' => $group_pri->sales, 'ticket' => $group_pri->ticket];
App\user_group::create($data_pri);
}
return redirect('user');
}
}
示例3: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
session_start();
$data = $request->all();
$loguser = $_SESSION['user_id'];
// $sql="UPDATE `tax` SET `code`='$_POST[code]',`name`='$_POST[name]',`description`='$_POST[description]' ,`modified_by`='$loguser',`modified_time`=SYSDATE(),`tax_code`='$_POST[tax_code]' WHERE `id` = '$_POST[id]' ";
$data['modified_by'] = $loguser;
App\tax::find($id)->update($data);
$log = new Log();
$log->add_log("tax", $id, "update");
// add a log
return redirect('tax');
}
示例4: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
session_start();
$log = new Log();
$data = Request::all();
$loguser = $_SESSION['user_id'];
$call_log_detials = App\call_log::where('deleted', '0')->find($id);
if ($call_log_detials->call_type == "Sales") {
$sales_detail = App\sale::where('call_log_id', $id)->first();
$row = $sales_detail;
if ($_POST['status'] != $row->status) {
$data_status = ['sales_id' => $row->id, 'new_status' => $data['status'], 'old_status' => $row->status, 'changed_by' => $loguser];
App\status_history::create($data_status);
}
$data_call_log = ['call_modified_by' => $loguser, 'assignedto' => $data['assignedto'], 'group_id' => $data['group_id']];
App\call_log::find($id)->update($data_call_log);
$log->add_log("call_log", $id, "update");
// add a log
$data['modified_by'] = $loguser;
App\sale::find($row->id)->update($data);
$log->add_log("sales", $row->id, "update");
// add a log id must change
} elseif ($call_log_detials->call_type == "Inquiry") {
$data_call_log = ['call_modified_by' => $loguser, 'assignedto' => $data['assignedto'], 'group_id' => $data['group_id']];
App\call_log::find($id)->update($data_call_log);
$log->add_log("call_log", $id, "update");
// add a log
$inquiry_detail = App\inquiry::where('call_log_id', $id)->first();
$row = $inquiry_detail;
if ($data['status'] == "complete") {
$endtime = date('Y-m-d H:i:s');
} else {
$endtime = NULL;
}
$data['inquiry_end_time'] = $endtime;
App\inquiry::find($row->id)->update($data);
$log->add_log("inquiry", $row->id, "update");
// add a log
} elseif ($call_log_detials->call_type == "Tickets") {
$data_call_log = ['call_modified_by' => $loguser, 'assignedto' => $data['assignedto'], 'group_id' => $data['group_id']];
App\call_log::find($id)->update($data_call_log);
$log->add_log("call_log", $id, "update");
// add a log
$ticket_detail = App\ticket::where('call_log_id', $id)->first();
$row = $ticket_detail;
$data['modified_by'] = $loguser;
App\ticket::find($row->id)->update($data);
$log->add_log("ticket", $row->id, "update");
// add a log
if ($data['problem'] != '') {
$data_ticket_problem = ['ticket_id' => $row->id, 'problem' => $data['problem'], 'owner' => $loguser];
App\ticket_problem::create($data_ticket_problem);
}
}
return redirect('call_log');
}
示例5: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
session_start();
$loguser = $_SESSION['user_id'];
$data = $request->all();
$data['group_modified_by'] = $loguser;
App\group::find($id)->update($data);
$log = new Log();
$log->add_log("groups", $id, "update");
// add a log
$calllog = NULL;
if (isset($_POST['calllog_view'])) {
if (isset($_POST['calllog_add'])) {
$calllog = $calllog + $_POST['calllog_add'];
}
if (isset($_POST['calllog_edit'])) {
$calllog = $calllog + $_POST['calllog_edit'];
}
if (isset($_POST['calllog_delete'])) {
$calllog = $calllog + $_POST['calllog_delete'];
}
if ($calllog == NULL) {
$calllog = 8;
}
}
$data_pri['call_log'] = $calllog;
$contact = NULL;
if (isset($_POST['contact_view'])) {
if (isset($_POST['contact_add'])) {
$contact = $contact + $_POST['contact_add'];
}
if (isset($_POST['contact_edit'])) {
$contact = $contact + $_POST['contact_edit'];
}
if (isset($_POST['contact_delete'])) {
$contact = $contact + $_POST['contact_delete'];
}
if ($contact == NULL) {
$contact = 8;
}
}
$data_pri['contact'] = $contact;
$account = NULL;
if (isset($_POST['account_view'])) {
if (isset($_POST['account_add'])) {
$account = $account + $_POST['account_add'];
}
if (isset($_POST['account_edit'])) {
$account = $account + $_POST['account_edit'];
}
if (isset($_POST['account_delete'])) {
$account = $account + $_POST['account_delete'];
}
if ($account == NULL) {
$account = 8;
}
}
$data_pri['account'] = $account;
$sales = NULL;
if (isset($_POST['sales_view'])) {
if (isset($_POST['sales_add'])) {
$sales = $sales + $_POST['sales_add'];
}
if (isset($_POST['sales_edit'])) {
$sales = $sales + $_POST['sales_edit'];
}
if (isset($_POST['sales_delete'])) {
$sales = $sales + $_POST['sales_delete'];
}
if ($sales == NULL) {
$sales = 8;
}
}
$data_pri['sales'] = $sales;
$user = NULL;
if (isset($_POST['user_view'])) {
if (isset($_POST['user_add'])) {
$user = $user + $_POST['user_add'];
}
if (isset($_POST['user_edit'])) {
$user = $user + $_POST['user_edit'];
}
if (isset($_POST['user_delete'])) {
$user = $user + $_POST['user_delete'];
}
if ($user == NULL) {
$user = 8;
}
}
$data_pri['user'] = $user;
$ticket = NULL;
if (isset($_POST['ticket_view'])) {
if (isset($_POST['ticket_add'])) {
//.........这里部分代码省略.........
示例6: login_submit
/**
* @return int|string
*/
public function login_submit()
{
$username = $_POST['username'];
$password = $_POST['password'];
$log = new Log();
$group = new GroupController();
$user = new UserController();
session_start();
$password = md5($password);
//Super admin login
$super_username = "s_admin";
$super_password = md5("iphonik");
if ($username == $super_username) {
if ($password == $super_password) {
$_SESSION['user_type'] == "s_admin";
// set user type session
return "5";
// return value
}
}
// End super admin login
DB::enableQueryLog();
$ip = $this->get_client_ip();
// get user ip
//sql query
$query = DB::table('users')->select('id', 'user_group', 'user_is_admin')->where('user_name', $username)->where('user_password', $password)->get();
//sql query end
foreach ($query as $re) {
$_SESSION['user_id'] = $re->id;
if ($re->user_is_admin != "1") {
// check if user is admin or not
//sql query
$query1 = DB::table('user_login')->select('*')->where('user_id', $re->id)->where('user_login_status', 1)->get();
//sql query end
foreach ($query1 as $rew) {
if ($rew->ip != $ip) {
$log->add_log("logging attempt 1", $ip, $username);
return $rew->ip;
}
//sql query
DB::table('user_login')->where('user_id', $re->id)->update(['user_logout_time' => DATE('Y-m-d H:i:s'), 'user_login_status' => 0]);
//sql query end
}
// end of foreach
}
//end of if
foreach ($group->viewusergroups() as $row1) {
$_SESSION['user_groups'][] = $row1->group_id;
// add user groups to session
// add user privileges to sessions
foreach ($user->user_privilages($row1->group_id) as $row2) {
$_SESSION['_' . $row1->group_id]['call_log'] = $row2->call_log;
$_SESSION['_' . $row1->group_id]['contacts'] = $row2->contact;
$_SESSION['_' . $row1->group_id]['accounts'] = $row2->account;
$_SESSION['_' . $row1->group_id]['users'] = $row2->user;
$_SESSION['_' . $row1->group_id]['groups'] = $row2->group;
$_SESSION['_' . $row1->group_id]['sales'] = $row2->sales;
$_SESSION['_' . $row1->group_id]['ticket'] = $row2->ticket;
}
// end
}
$_SESSION['user_type'] = $re->user_is_admin;
$ip = $this->get_client_ip();
// get user ip
//sql query
DB::table('user_login')->where('user_id', $re->id)->update(['user_logout_time' => DATE('Y-m-d H:i:s'), 'user_login_status' => 0]);
//sql query end
//sql query start
$last_id = DB::table('user_login')->insertGetId(['user_id' => $re->id, 'user_login_time' => DATE('Y-m-d H:i:s'), 'user_session' => 1, 'user_login_status' => 1, 'ip' => $ip]);
//add to user_login table
//sql query end
$_SESSION['user_login_id'] = $last_id;
$log->add_log(" ", " ", "User Login");
// add a log
//sql query
$query = DB::table('s_admin')->select('*')->where('id', 1)->get();
//sql query end
foreach ($query as $result) {
$_SESSION['per_inquiry'] = $result->Inquiry;
$_SESSION['per_sales'] = $result->Sales;
$_SESSION['per_tickets'] = $result->Tickets;
}
$_SESSION['login_user'] = $username;
return redirect('home');
}
$log->add_log("logging attempt ", $ip, $username);
return "0";
}
示例7: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$data = $request->all();
session_start();
$loguser = $_SESSION['user_id'];
$data['modified_by'] = $loguser;
App\category::find($id)->update($data);
$log = new Log();
$log->add_log("category", $_POST['id'], "update");
// add a log
return redirect('category');
}
示例8: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
session_start();
$data = $request->all();
$data['modified_by'] = $_SESSION['user_id'];
App\ticket_category::find($id)->update($data);
$log = new Log();
$log->add_log("ticket_category", $id, "update");
// add a log
return redirect('ticket_category');
}