Today, i will show you how to add confirm box before delete item in php. It's always necessary to confirm yes or no about that removing record. If we confirm before delete records it's safe to client that delete right records. So in this post i will show you how to add confirmation popup of jquery and remove item dynamically.
Here, i have simple create "users" table and then list all users with table using bootstrap. Using bootstrap it looks better layout. So added delete button, when user will click on delete button confirm box open and ask to remove or not current item. after click on yes f.....
It's almost need to give feature for remove multiple records using checkbox, if you are developing e-commerce application or any big web application then you must give feature to delete multiple records.
So in this post, i will let you know how to delete multiple records with checkbox in laravel 5 application. here i also give multiple delete and you can also delete single records. Few days ago i posted for confirmation before delete record, so you can read from here : <a href="http://itsolutionstuff.com/post/laravel-5-confirmation-before-delete-record-from-database-exampleexample.html" targ.....
Hi Guys, In this post we will learn how to open confirm model box before deleting item in laravel 5 application. As we know very well delete operation is very command and basic feature of every web application. Also delete operation is very important part because if you remove item, post, product, category etc then it will remove from your browser. So we should always prefer to confirmation before remove item.
There are several options available to use confirm like jquery ui confirm, sweetalert, bootbox, bootstrap confirmation etc jquery plugin. So we almost use bootstrap theme so it would al.....
If you work on AngularJS web application using angular route then you notice one thing. If you click on any hyper links it makes like as bellow:
I mean always "#" will be there, But when we live this web application then it should delete "#" from URL, because it makes issue when we share link on facebook or etc.
But should look likes:
But we can remove easily using "$locationProvider.html5Mode(true);". Yo.....
Sometimes, we require to remove comma, semicolon, colon etc from string in your jquery code At that time you can simply remove comma using js replace(). Jquery replace() through we can replace comma into empty string that way comma will be remove from jquery string.
In this example you can see how it works. It small thing but helpful because this you can also delete semicolon ,colon ,dot etc. So, let's try bellow example and see..
<pre class="prettyprint lang-html">
<title>Jquery remove comma from string</title>
Sometimes it can be agreeable to remove a database column that hosts a foreign key relationship, and we add wrong column with foreign key constraint on table, At that time we must remove that column from table.
But we can't remove directly using dropColumn() because we did apply foreign key constraint so we should drop foreign key constraint of that column using dropForeign() and then we can delete column using dropColumn(). You can see as bellw migration, first i added migration with wrong column then other migration for remove that column.
<strong>Wrong Column Migration:</strong>
Normally, we remove row from database when delete record from site. But laravel 5 introduce SoftDeletes in models that way we can't remove from database but if remove record from front side then it doesn't show record on front. So we can retrieve record from database if we remove wrong row.
How work soft delete, laravel add <strong class="path">deleted_at</strong> column on the table that be default will be null and when we remove then it will place current timestamp, Laravel Model always fetch that record have only <strong class="path">deleted_at</strong> = null.
So, how to use in our proje.....
Onetime i was need to check which files i deleted before, When i was working on my laravel application. I was try to find how to show deleted files log from git command. But at last found git command from google search. we can view all deleted file log from our git repository. So, let's fire bellow command.
git log --diff-filter=D --summary
Sometimes we require to remove white space from given string. So at that time you can delete spaces from string using str_replace() of core php. str_replace() will help to replace whitespace that way we can remove. you can do it from bellow example.
<pre class="prettyprint lang-php">
$myString = "this is only for you";
$resultString = str_replace(' ', '', $myString);
Sometimes we need to fire trigger like after delete update some fields of another tables. for example if you have chat_message tables and when remove row on this table then we need to update "remove_counter(remove_counter + 1)" on users table. i did give you bellow example you can see how to write trigger code:
<pre class="prettyprint lang-php">
CREATE TRIGGER add_ban_counter_in_users
AFTER DELETE ON `chat_messages`
FOR EACH ROW
SET remove_counter = users.remove_counter + 1
WHERE users.id = old.user_id.....