Results: 1578
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
fields types in mysql table relationships
In
many to many
relationship
user_id
inside
user_roles
table must be exactly the same as the
id
field inside
users
table Example: if
users->id
is
bigint(20) unsigned
then
user_role->user_id
must be exactly
bigint(20) unsigned
by Valeri Tandilashvili
4 years ago
0
Laravel
1
The password
123
will be encrypted and then decrypted back with
AES-128-ECB
encryption algorithm. Encrypts the text using the secret key
sec key
function encrypt_text($text, $secret_key)
{
    return openssl_encrypt($text,"AES-128-ECB", $secret_key);
}
Decrypts encrypted text (first parameter) using the secret key (second parameter)
function decrypt_text($encrypted_string, $secret_key)
{
    return openssl_decrypt($encrypted_string,"AES-128-ECB", $secret_key);
}
Calls the above two functions to perform encryption and decryption
// Secret key, that is used to encrypt and decrypt the 
$text
content $secret = 'sec key'; // the text that we want to encryption and decryption $text = '123'; $password_encrypted = encrypt_text($text, $secret); $password_decrypted = decrypt_text($password_encrypted, $secret); echo 'Encrypted text: ' . $password_encrypted . '<br>'; echo 'Decrypted password: ' . $password_decrypted;
by Valeri Tandilashvili
4 years ago
0
PHP
encrypt/decrypt
1
php artisan make:model Asset -m -c -r
Long version of the above command would be:
php artisan make:model Asset --migration --controller --resource
by Valeri Tandilashvili
4 years ago
0
Laravel
artisan commands
1
The var keyword allows us to redeclare a variable without any issue:
var counter = 10;
var counter;
console.log(counter); // 10
However, if we redeclare a variable with the let keyword, we will get an error:
let counter = 10;
let counter; // undefined
by Luka Tatarishvili
4 years ago
0
JavaScript
variables
1
The global var variables are added to the global object as properties.
var counter = 0;
console.log(window.counter); //  0
However, the let variables are not added to the global object:
let counter = 0;
console.log(window.counter); // undefined
by Luka Tatarishvili
4 years ago
0
JavaScript
variables
1
for (let i = 0; i < 5; i++) {
    console.log(`Inside the loop: ${i}`);
}

console.log(`Outside the loop: ${i}`);
output:
Inside the loop: 0
Inside the loop: 1
Inside the loop: 2
Inside the loop: 3
Inside the loop: 4
and will be error:
Uncaught ReferenceError: i is not defined
because t the variable 'i' only exists and can be accessible inside the for loop block.
by Luka Tatarishvili
4 years ago
0
JavaScript
variables
1
for (var i = 0; i < 5; i++) {
    console.log(`Inside the loop: ${i}`);
}

console.log(`Outside the loop: ${i}`);
output:
Inside the loop: 0 
Inside the loop: 1 
Inside the loop: 2 
Inside the loop: 3 
Inside the loop: 4 
Outside the loop: 5
In this example, the
 i
variable is a global variable. Therefore, it can be accessed from both inside and after the for loop.
by Luka Tatarishvili
4 years ago
0
JavaScript
variables
0
When you declare a variable inside a function using the var keyword, the scope of the variable is local. For example:
function increase() {
    var counter = 10;
}
// cannot access the counter variable here
In this example, the
counter
variable is local to the increase() function. It cannot be accessible outside of the function.
by Luka Tatarishvili
4 years ago
0
JavaScript
variables
0
They can be used to call an object method with another object as argument.
var person1 = {
  fullName: function() {
    return this.firstName + " " + this.lastName;
  }
}
var person2 = {
  firstName:"John",
  lastName: "Doe",
}
person1.fullName.call(person2);  // Will return "John Doe"
person1.fullName.apply(person2);  // Will return "John Doe"
by Luka Tatarishvili
4 years ago
0
JavaScript
objects
0
In this example, "this" is the person object (The person object is the "owner" of the function), so it refers to the person object.
var person = {
  firstName  : "John",
  lastName   : "Doe",
  id         : 5566,
  myFunction : function() {
    return this; // [object Object]
    return this.firstName + " " + this.lastName; // John Doe
  }
};
by Luka Tatarishvili
4 years ago
0
JavaScript
objects
0
Results: 1578