本文整理汇总了PHP中App\Http\Controllers\DB::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::delete方法的具体用法?PHP DB::delete怎么用?PHP DB::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Http\Controllers\DB
的用法示例。
在下文中一共展示了DB::delete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: KisiSil
function KisiSil()
{
\Auth::logout();
\Session::flush();
\DB::delete('delete from users WHERE name = ?', [\Request::input('isim')]);
return \Redirect::to('auth/register');
}
示例2: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
\DB::delete('delete from levels where id = ?', [$id]);
return redirect('level');
}
示例3: postEditload
public function postEditload($id)
{
if (\Auth::check()) {
$action = \Input::get('action');
$data = \Input::all();
// dd($data);
if ($action == 'delete') {
\DB::delete('delete from faculty_load where id =' . $id);
} else {
if ($action == 'save') {
\DB::table('faculty_load')->where('id', $id)->update(array('subject' => $data['subject'], 'class' => $data['section'], 'semester' => $data['semester'], 'subj_code' => $data['subcode'], 'school_year_sy' => $data['sy'], 'school_year_users_id' => $data['id'], 'units' => $data['units']));
// \DB::update('update faculty_load set subject = .'.$data['subject'].',class=.$data['section'].', semester, subj_code, school_year_sy, school_year_users_id, year, units where id =' . $id);
}
}
}
return \Redirect::back();
}
示例4: moderationRecord
public function moderationRecord($p_id, $status)
{
if (\Auth::user()->admin == true) {
if (\DB::select('select 1 from moderation where p_id = ?', [$p_id])) {
$p_admin = \Auth::user()->name;
$date = new \DateTime();
$results = \DB::select('select * from moderation where p_id = ?', [$p_id]);
if ($status == 'approve') {
foreach ($results as $result) {
\DB::insert('insert into public.log_moderation (p_id, p_cat, p_admin, p_status, created_at, updated_at) values (?, ?, ?, ?, ?, ?)', [$p_id, $result->p_cat, $p_admin, 'available', $date, $date]);
\DB::insert('insert into stream.stream_' . $result->p_cat . ' (p_id, p_cat, p_ouser, p_title, p_caption, p_imgurl, p_status, p_reported, p_rating, created_at, updated_at) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [$result->p_id, $result->p_cat, $result->p_ouser, $result->p_title, $result->p_caption, $result->p_imgurl, 'available', $result->p_reported, $result->p_rating, $result->created_at, $date]);
\DB::delete('delete from public.moderation where p_id = ?', [$p_id]);
// Membuat tabel baru.
\Schema::create('comment.comment_' . $result->p_id, function ($table) {
$table->string('c_ouser', 120);
$table->string('c_favor');
$table->text('c_comment', 1000);
$table->string('avatar');
$table->timestamps();
});
}
$messages = 'The publication has been approved.';
return redirect('/admin/moderation')->with('messages', $messages);
} elseif ($status == 'deny') {
foreach ($results as $result) {
\DB::insert('insert into public.log_moderation (p_id, p_cat, p_admin, p_status, created_at, updated_at) values (?, ?, ?, ?, ?, ?)', [$p_id, $result->p_cat, $p_admin, 'denied', $date, $date]);
\DB::insert('insert into stream.stream_' . $result->p_cat . ' (p_id, p_cat, p_ouser, p_title, p_caption, p_imgurl, p_status, p_reported, p_rating, created_at, updated_at) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [$result->p_id, $result->p_cat, $result->p_ouser, $result->p_title, $result->p_caption, $result->p_imgurl, 'denied', $result->p_reported, $result->p_rating, $result->created_at, $date]);
\DB::delete('delete from public.moderation where p_id = ?', [$p_id]);
}
$messages = 'The publication has been denied.';
return redirect('/admin/moderation')->with('messages', $messages);
} else {
$messages = 'The processing status is not valid, only "approve" or "deny".';
return redirect('/admin/moderation')->with('messages', $messages);
}
} else {
$messages = 'There is no such publication, or publication has been processed.';
return redirect('/admin/moderation')->with('messages', $messages);
}
} else {
$messages = 'You are not an admin. No rights to access administration area.';
return redirect('/system/notification')->with('messages', $messages);
}
}
示例5: getConfirmWithParam
public function getConfirmWithParam($action, $id)
{
if ($action == 1) {
if (\DB::table('auth_telegram')->where('id', $id)->where('confirmed', false)->update(['confirmed' => true])) {
$messages = 'A User is Confirmed.';
return redirect('/confirm')->with('messages', $messages);
} else {
$messages = 'Error.';
return redirect('/confirm')->with('messages', $messages);
}
} elseif ($action == 2) {
if (\DB::table('auth_telegram')->where('id', $id)->where('confirmed', true)->update(['confirmed' => false])) {
$messages = 'A User is Released.';
return redirect('/confirm')->with('messages', $messages);
} else {
$messages = 'Error.';
return redirect('/confirm')->with('messages', $messages);
}
} elseif ($action == 3) {
if (\DB::delete('delete from auth_telegram where id = ? and confirmed = false', [$id])) {
$messages = 'A User is Deleted.';
return redirect('/confirm')->with('messages', $messages);
} else {
$messages = 'Error.';
return redirect('/confirm')->with('messages', $messages);
}
} else {
$messages = 'Error.';
return redirect('/confirm')->with('messages', $messages);
}
}
示例6: edit
public function edit()
{
//check for integer in quantity
if (!(Input::get('quantity') >= 0 && Input::get('quantity') < 1000)) {
Session::flash('type', "danger");
Session::flash('message', "Please enter a quantity between 1 and 1000");
return Redirect::back();
}
if (!Auth::check()) {
//create unregistered user and a new make for them
$user = new User();
$user->save();
Auth::login($user);
}
//save cookes for new user
if (!Session::has('order')) {
//create new order
$order = new Order();
$order->user_id = Auth::user()->id;
$order->status = 'Open';
$order->save();
Session::put('order', $order->id);
Session::put('orderCount', 0);
}
//return Session::has('order');
$quantity = Input::get('quantity');
$product_id = Input::get('product_id');
$colour_hex = Input::get('colour_hex');
$colour_name = Input::get('colour_name');
$action_id = Input::get('action_id');
$order = Order::with('product')->find(Session::get('order'));
//if order bnot open then send to dash with message
if ($order->status !== 'Quote' && $order->status !== 'Open') {
Session::flash('message', 'This order is locked. Please click \'Start a new quote\' below to begin another order');
Session::flash('alert-class', "alert-danger");
return Redirect::to('users/dashboard');
}
//return $order;
//derach product is the same as existing
//$order->product()->detach($product_id, ['hex' => $colour_hex]);
\DB::delete('delete from order_product where order_id = ? AND product_id = ? AND hex = ?', array($order->id, $product_id, $colour_hex));
//attach if not 0
if (Input::get('quantity') != 0) {
$order->product()->attach($product_id, ['quantity' => $quantity, 'colour' => $colour_name, 'hex' => $colour_hex]);
}
//count them again
$updatedOrder = Order::with('product')->find(Session::get('order'));
$orderCount = 0;
foreach ($updatedOrder->product as $products) {
$orderCount = $orderCount + 1;
}
//return $orderCount;
Session::put('orderCount', $orderCount);
//set message depending od whethet order is open or quote
if ($order->status !== 'Open') {
Session::flash('registerMessage', "You are updating an existing quote. When you are happy please click the green button below to confirm your update.");
Session::flash('type', "danger");
return redirect()->route('orders.show', [$order->id]);
}
//updating quantities
if ($action_id == 'update') {
return redirect()->route('orders.show', [$order->id]);
}
Session::flash('message', $quantity . " of these have been added to your quote");
Session::flash('type', "success");
return Redirect::back()->withCookie(cookie('user_id', Auth::user()->id, 3600));
//return $quantity;
}