Friday, November 25, 2022

Micros Cal formula

 First number x second number + fourth number + sixth number.
Code is 123456
then
1 x 2 + 4 + 6 = 12

Livewire Authorization

 

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

 
class EditPost extends \Livewire\Component
{
use AuthorizesRequests;
 
public $post;
 
public function mount(Post $post)
{
$this->post = $post;
}
 
public function save()
{
$this->authorize('update', $this->post);
 
$this->post->update(['title' => $this->title]);
}
}

Saturday, November 12, 2022

Replacing line break before inserting to mysql

 

var input = document.getElementById("input").value;

if (!input)
{
// Null or undefined or bad input
alert("Invalid input");
}



// Replace line-breaks with "\n"
this.logData.description = input.replace(/(?:\r\n|\r|\n)/g, '\\n');