Skip to main content

Posts

Showing posts from November, 2022

learning resources and channals

 For Laravel Channal Name : A ndrew Schmelyun Link: https://www.youtube.com/@aschmelyun 10 useful websites for web developement https://www.youtube.com/watch?v=uhNLY5y9-Kg&list=PL_ZUs2eBjBisBYhqBmy7aDuBSl6mjxCdr&index=7  React Native Bug Ninza : It is a youtube channal.

Two ways setup foreign key constained in migration

 

Free SSL

SSL Generator https://punchsalad.com/ssl-certificate-generator/ https://manage.sslforfree.com/ guide for different servers https://help.zerossl.com/hc/en-us/articles/360058295854-Installing-SSL-Certificate-on-Apache How to import an SSL Certificate in Apache Server? https://www.youtube.com/watch?v=Hw2IZkqG5_s for me SSLCertificateKeyFile /etc/ssl/sslbyadnan/private.key SSLCertificateFile /etc/ssl/sslbyadnan/certificate.crt SSLCACertificateFile /etc/ssl/sslbyadnan/ca-bundle.crt

install and updrage php on Oracle and on CentOS 8 Linux

  ==================Upgrade php Video lisk https://www.youtube.com/watch?v=bHTv0FmvrTo DNF package manager guid for installing and enabling the php https://techglimpse.com/install-php-centos-stream/ DNF DNF is a software package manager that installs, updates, and removes packages on Fedora and is the successor to YUM (Yellow-Dog Updater Modified). DNF makes it easy to maintain packages by automatically checking for dependencies and determines the actions required to install packages. https://docs.fedoraproject.org/en-US/quick-docs/dnf/ What is remi repo ? Remi repo is a free and stable YUM repository mainly for the PHP stack. It contains packages for the latest versions of PHP. This article describes how to use Remi repo on CentOS 5/6/7 Install guide for php latest version (any version) Step 1: Enable remi-release-8.rpm Configure the  Remi repository  for installing PHP 8 on CentOS 8 # dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm Step 2: Enable EPE...

Define group routes and apply middleware on routes

 In ths article we will se how to define group route, also apply "middleware" on it. Define "prefix" and route "name" as well Route :: group ([ 'middleware' => [ 'auth' , 'verified' ], 'prefix' => 'tags' , 'as' => 'tags.' ], function () {     Route :: get ( '/' ,\App\Http\Livewire\Tuts\ Tag :: class )-> name ( 'index' );     // so route name will be like so tags.index });

Real-time Validation in livewire

 Livewire gives you the opportunity to make real-time validation of your form. let me show you how it works. Inside your components class namespace App\Http\Livewire\Tuts ; use Livewire\ Component ; class ContactForm extends Component {     public $name ;     public $email ;     public $message ;     protected $rules = [         'name' => [ 'required' ],         'email' => [ 'required' , 'email' ],         'message' => [ 'required' , 'max:10' ]     ];     public function render ()     {         return view ( 'livewire.tuts.contact-form' )-> layout ( 'layouts.app' )-> slot ( 'main' );     }     public function updated ( $propertyName )     {         $this -> validateOnly ( $propertyName );     }     public function submit (){ ...

Life cycle hooks in livewire

 LifeCycle Hooks in livewire are following 1. mount() 2. hydrate() 3. dehydrate() 4. updating() // when the public property is updating, the updating method automatically calls. 5. updated() // when the public property is updated, the updated method automatically call.

Event and listeners in livewire

 Now are gonna see events and listeners in livewire and see how they work in livewire. We can fire events  1. In the view 2. In the component 3. In javascript Now i want to emit a global event. So there are four ways to emit. 1. $this->emit() this is Global. 2. $this->emitup() child to parent. 3. $this->emitSelf() emit an event to self in the current component. 4. $this->emitTo() emit event to specific livewire component. e.g: $this->emitTo(UserDetails,'parameter'); In the View <h3>Emit Browser Event</h3> <button wire:click= " $emit ('openStore')" class = "btn btn-primary btn-md my-2 mx-2" >Emit Event</button> In javascript <!-- livewire Events --> <script>    window. addEventListener ( 'openTheShop' , event => {        Livewire. emit ( 'openStore' );    }); </script>       Most of the time we use javascript events to show alert and toast messages as well.  ...

Actions in livewire

 Most of the time we use event in the javascript like click, double click, mouse up, down etc. In livewire we use/ fire these events on certain Action. These on any action accure there event which to this action and do some operation, rerender etc. To fire / intiate action we need to write on the button or where you want to use the action. <div>     <button wire:click= "connect" class = "btn btn-primary btn-md" >Connect Button</button> </div> And inside livewire Controller Class define a method named "connect" public function connect () {     dd ( 'connected' ); }  All Browser Events list Click the link below https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values Most usable events in livewire <div>     <h1 class = "h2" >Actions in Livewire</h1>         <button wire:click= "connect"           class = "btn btn-primary btn...

Laravel Case Sensitive Query Search Example

       Sometime we have records in users table with following name like "Adnan", "ADNAN" and "adnan". now you just need to get case sensitive name like if you search "Adnan" then it should only get that record. so that solution i will give you simple example and show you how to make case sensitive query using mysql BINARY in laravel. you can use this example in laravel 6, laravel 7, laravel 8 and laravel 9 version. $users = User :: select ( "id" , "name" , "email" ) -> where ( DB :: raw ( 'BINARY `name`' ), "Adnan" ) -> get ();

Send email in php "without less secure" restriction

 => https://www.youtube.com/watch?v=Kjn5vBbBsi8 (less secure link) https://www.youtube.com/watch?v=dNTZ8X9Xk_Q&t=259s https://www.thapatechnical.com/2020/03/how-to-send-mail-from-localhost-xampp.html LARAVEL env file setup for gmail configuration MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=465 MAIL_USERNAME=exampleEmail@gmail.com MAIL_PASSWORD=yourAppPassword MAIL_ENCRYPTION=ssl MAIL_FROM_ADDRESS=exampleEmail@gmail.com MAIL_FROM_NAME="Adnan Zaib" Note: for TLS use Port : 587 for SSL use Port : 465