Sunday, December 8, 2024

Office 365 SMPT

 PS C:\Users\akmyi> Connect-ExchangeOnline

----------------------------------------------------------------------------------------
This V3 EXO PowerShell module contains new REST API backed Exchange Online cmdlets which doesn't require WinRM for Client-Server communication. You can now run these cmdlets after turning off WinRM Basic Auth in your client machine thus making it more secure.

Unlike the EXO* prefixed cmdlets, the cmdlets in this module support full functional parity with the RPS (V1) cmdlets.

V3 cmdlets in the downloaded module are resilient to transient failures, handling retries and throttling errors inherently.

REST backed EOP and SCC cmdlets are also available in the V3 module. Similar to EXO, the cmdlets can be run without WinRM basic auth enabled.

For more information check https://aka.ms/exov3-module
----------------------------------------------------------------------------------------

PS C:\Users\akmyi> Set-TransportConfig -SmtpClientAuthenticationDisabled $false
PS C:\Users\akmyi> Get-TransportConfig | Format-List SmtpClientAuthenticationDisabled


SmtpClientAuthenticationDisabled : False

Thursday, September 12, 2024

Cannot import exchangeonline powershell

 To fix this you need to change the execution policy for this computer. To do this, you need to run PowerShell with administrator rights, then run this command and accept changes.

Set-ExecutionPolicy Bypass

Tuesday, August 27, 2024

Friday, August 16, 2024

Git

 git remote add origin https://<PAT>@github.com/<account>/<repo>.git

 

git init

git add .

commit -m "

 

git switch master

Or:

git checkout master 
 
git remote -v
# View existing remotes
# origin  https://github.com/user/repo.git (fetch)
# origin  https://github.com/user/repo.git (push)

git remote set-url origin https://github.com/user/repo2.git

 To check/get old values:

git config --global user.email
git config --global user.name
git config --global user.email '<git-commit-address>'
git config --global user.name yournewgoodname
git config --global --unset credential.helper
 
git config --list --show-origin 
 
//git make a ophan brnach and checkout
git checkout --orphan latest_branch

//git add all files
git add .

//git commit message
git commit -m "commit message"

//git delete your main/master brnach (if you have main write main instead of master everywhere below)
git branch -D master

//git rename your orphan latest_branch to master
git branch -m master

//git push damn everything
git push -f origin master 
 
git fetch repo_link branch
git add .
git commit -a -m "message"
git push origin master 

 

Deployment Laravel on cloud by Github

1) Git Clone

2) composer install

3) npm install

4) cp .env.example .env
5) php artisan key:generate
6) php artisan migrate:fresh --seed 

 




php artisan passport:install
php artisan passport:keys --force
sudo chmod -R 0777 ./storage   

Monday, August 12, 2024

folder permission for Laravel deployment

 sudo chgrp -R www-data storage bootstrap/cache

 

sudo chmod -R ug+rwx storage bootstrap/cache 


sudo chmod -R 0777 ./storage 

Saturday, August 10, 2024

Sending email with Queue

 

php artisan queue:table
.env 
QUEUE_CONNECTION=database
php artisan make:job xxxxxx
<?php

namespace App\Jobs;

use App\Mail\NotiPayment;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Mail;

class SendPaymentNotiQueue implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
    protected $cc;
    public $payment;
    /**
     * Create a new job instance.
     */
    public function __construct($payment,$cc)
    {
   
        $this->payment = $payment;
        $this->cc = $cc;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $email = new NotiPayment($this->payment);
        Mail::to('ap@inyalakehotel.com')->cc($this->cc)->send($email);
    }
}
 
php artisan make:mail xxxxx
 
<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class NotiPayment extends Mailable
{
    use Queueable, SerializesModels;
    public $request;
    /**
     * Create a new message instance.
     */
    public function __construct($request)
    {
        $this->request = $request;
    }

    /**
     * Get the message envelope.
     */
    public function envelope(): Envelope
    {
        return new Envelope(
            subject: 'Noti Payment',
        );
    }

    /**
     * Get the message content definition.
     */
    public function content(): Content
    {
        return new Content(
            view: 'email.notipayment',
        );
    }

    /**
     * Get the attachments for the message.
     *
     * @return array<int, \Illuminate\Mail\Mailables\Attachment>
     */
    public function attachments(): array
    {
        return [];
    }
}


 
create template for mail under view\email
 
Controller
    public function store(Request $request)
    {
        $last= Payment::orderBy('id', 'DESC')->first();
        if($last){
            $last_id = $last->id + 200000 ;
        }else{
            $last_id = 200000;
        }

        $validateData = $request->validate([
            'payment_date' => 'required',
            'supplier' => 'required',
            'currency'=>'required',
            'amount'=>'required|numeric',
            'ct'=>'required|numeric',
            'ac_name'=>'required',

            'settle_by'=>'required',



        ]);
        if(!$request->ct==0){
            $ct = $request->amount * $request->ct/100;
        }else{
            $ct = 0;
        }
       
        $payment = new Payment();
        $payment->payment_date = $request->payment_date;
        $payment->supplier = $request->supplier;
        $payment->currency = $request->currency;
        $payment->amount = $request->amount;
        $payment->ct = $request->ct;
        $payment->py_no = $last_id;
        $payment->description = $request->description;
        $payment->ac_name = $request->ac_name;
        $payment->settle_by = $request->settle_by;
        $payment->department_id = Auth::user()->department_id;
        $payment->user_id = Auth::user()->id;
        $payment->signature = Auth::user()->signature;



        $payment->save();
        $cc = Auth::user()->email;
        SendPaymentNotiQueue::dispatch($payment,$cc);

        return response()->json('Success');
    }
 
  
* * * * * cd /var/www/html/ilhapp && php artisan queue:work --stop-when-empty
 

Monday, July 29, 2024

Fontawesome in Laravel

 npm install --save-dev vite

 

npm install --save @fortawesome/fontawesome-free

 

 Edit or create resources/css/app.css and add the following code:

@import '@fortawesome/fontawesome-free/css/fontawesome.css';
@import '@fortawesome/fontawesome-free/css/regular.css';
@import '@fortawesome/fontawesome-free/css/solid.css';
@import '@fortawesome/fontawesome-free/css/brands.css'; 


Edit or create vite.config.js file in the root directory of your Laravel project and configure Vite to bundle Font Awesome along with your asset

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
    plugins: [
        laravel({
            input: ['resources/css/app.css', 'resources/js/app.js'],
            refresh: true,
        }),
    ],
});


Should you prefer SASS over CSS follow the steps outlined below.

First install SASS by running:

npm install -D sass 


Then edit resources/app.js and copy+paste the following code:

 

import './bootstrap';

import '@fortawesome/fontawesome-free/scss/fontawesome.scss';
import '@fortawesome/fontawesome-free/scss/brands.scss';
import '@fortawesome/fontawesome-free/scss/regular.scss';
import '@fortawesome/fontawesome-free/scss/solid.scss';
import '@fortawesome/fontawesome-free/scss/v4-shims.scss';

Monday, July 8, 2024

Ubuntu extend LVM

 https://packetpushers.net/blog/ubuntu-extend-your-default-lvm-space/

Sunday, May 26, 2024

Thursday, March 14, 2024

Validation Regex

 

 'name' => 'required|unique:rooms|not_regex:/(0)[1-9][0-9]{2}$/|min:2',

Friday, January 19, 2024

v-viewer

 

npm install v-viewer viewerjs

 onImageClick: function(attachment) {
     
        this.$viewerApi({
          attachments : attachment,
        })
     
    },


 

<div v-for="attachment in attachments" class="images" v-viewer>

Monday, January 8, 2024

Apache error

 

Get solution for the issue, need to change in apache2.conf file after that it will works,

old code in /etc/apache2/apache2.conf

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

changed in to

 <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
    </Directory>

after that, In order for Apache to understand rewrite rules, we first need to activate mod_rewrite. It's already installed, but it's disabled on a default Apache installation. Use the a2enmod command to enable the module:

$ sudo a2enmod rewrite

This will activate the module or alert you that the module is already enabled. To put these changes into effect, restart Apache.

$ sudo systemctl restart apache2

it works for me finally.