If you need to add a foreign key reference to the user in the foreign table, you should know that id column formats must match  in users & new tables.

Example:

Create a user table (by default in Laravel 8):

Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});

In this case, we see that the type of id is not clearly specified, but if you look in the database, you can see that it is bigint(20)

...

If you need to count the number of days between two PHP dates, it is convenient to use DateTime.

Example:

$date1 = DateTime::createFromFormat('d-m-Y', '15-02-2022');
$date2 = DateTime::createFromFormat('d-m-Y', '19-02-2022');

$difference = date_diff($date1, $date2);
$differenceDayCount = $difference->days;
var_dump($differenceDayCount); // 4

If you want to change link click default behavior, you could use jQuery for this purpose. 

Let's assume we have a link:

<a href="/link" id="example-link">Link</a>

jQuery code, which will prevent link click default action:

$('#example-link').click(function(e) {
e.preventDefault();
//your code
});

The key thing here is the e parameter, which is passed to the function and the e.preventDefault()  

To troubleshoot email sending errors in Laravel you can:

1. Set up:

MAIL_DRIVER=log

in the mail settings in the ENV file.

E-mails wouldn't be sent, but will be written to the  logs folder -where you can check email parameters.

2. To display configuration data for email sending:

dd(config('mail'));

If you write \ in the Laravel database request incorrectly, you won't get the expected result.

The point is that \ is an escape character.

For example, if you need to get a model from the database with the App\Picture type:

ModelName::where('type', 'like', 'App\\\\Picture')->get()

As you can see from the code above, the single slash is replaced with 4: \\\\

To calculate a hash using SHA256 format for a string in PHP, you need to use the hash function:

$myString = 'test';
$result = hash('sha256', $myString);

where

$myString - is the string to be encoded.

The first parameter passed to the hash function is the hashing algorithm, it can be different, for example "md5", "sha1", "haval160,4", etc.

You can find out all available algorithms using the hash_algos() function

SVG navigation icon for mobile website design:

Code:  

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1.2em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 1536 1280"><path d="M1536 1088v128q0 26-19 45t-45 19H64q-26 0-45-19t-19-45v-128q0-26 19-45t45-19h1408q26 0 45 19t19 45zm0-512v128q0 26-19 45t-45 19H64q-26 0-45-19T0 704V576q0-26 19-45t45-19h1408q26 0 45 19t19 45zm0-512v128q0 26-19 45t-45 19H64q-26 0-45-19T0 192V64q0-26 19-45T64 0h1408q26 0 45 19t19 45z" fill="currentColor"/></svg>

Result:

Code:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="35" height="35" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M13.41 12l4.3-4.29a1 1 0 1 0-1.42-1.42L12 10.59l-4.29-4.3a1 1 0 0 0-1.42 1.42l4.3 4.29l-4.3 4.29a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l4.29-4.3l4.29 4.3a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42z"/></svg>

 

There was a problem that after updating Android to version 11, the notification bar stopped working [ phone model - Realme 6 pro, but it may work for others as well].

How did we fix it:

First you need to check that this item is active in your phone settings:

Settings - Notifications and status bar - “Pull down on the lock screen to open the notification panel”

Then we blocked the phone.  In the locked mode we tried to pull out the notification bar.

After the notification bar is activated in the locked mode, it starts to work in the main mode as well.

Sometimes it is necessary to show the user html form content, but so that the user does not have the opportunity to change anything on it.

There are different ways to do this, but the simplest is to surround the form with a fieldset tag with the disabled = "disabled" attribute:

 

<fieldset disabled="disabled">
<form>
<input type="text" name="example" value="123" />
</form>
</fieldset>