Monday, 19 October 2020

Creating a Secured Laravel Homestead SSH

Open Homestead.yaml file and add SSL = true it will create crt file in /etc/nginx/ssl


Sample Homestead.yaml file
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: /Users/junedc/Desktop/AMyProject/cafefrends
      to: /home/vagrant/code/cafefrends

sites:
    - map: cafefrends.test
      to: /home/vagrant/code/cafefrends/public

ssl:
     - true

Some commands to generate ssh key,  create a certificate, reload the new settings

xxxx
 ssh-keygen -t rsa
 vagrant up 
 vagrant ssh 
 cp cafefrends.test.crt /home/vagrant/code/cafefrends 
 
 vagrant halt
 vagrant reload --provision


In your mac KeyChain Access Add the crt file that was created in the previous step and set the SSL to 'Always Trust'
Share:

Thursday, 31 October 2019

Laravel creating an interface and implementation dynamically

Somehow you need to run a different implementation depending on system environment This is what i have done for one of my case
In your .env file In my AppServiceProvider.php DocumentInterface.php GoogleCloudImplementation.php LocalStorageImplementation.php
Share:

Thursday, 17 October 2019

Command needed when installing MySQL

MySQL command not found? Looking tru this forum https://stackoverflow.com/questions/10577374/mysql-command-not-found-in-os-x-10-7 To connect to MySQL prompt Change the MySQL password permanently
Share:

Wednesday, 24 July 2019

The Date Problem for Laravel and Regional Settings

For every Laravel application birthday should be displayed as it was saved. It should have a type 'date' and those 'created_at' should be 'datetime'
From New Zealand the record could be created Friday but for Cooks Island the record can be Thursday entry.
This is where PHP Carbon date comes to uses and Javascript Moments.

Install Moment and format as required. In VueJS create a filter You might need to format the fields requests when saving Database Migration Scripts
Share:

Monday, 8 July 2019

Laravel Eloquent Relationship 101

Laravel uses the default 'id' as the primary key when defining table.
With this in mind we will be having difficulty especially if we are using Laravel eager loading style as stated in stackoverflow.
In order to have that peace of mind when loading fields it is safer to create a different id key for different table. This is how to go with that approach.
For our parent migration script we have For our child table, we will have To complete the migration script for address This is how to define the relationship that an Author can write 1 or more books. The relationship also shows that he lives in just one (1)address at a time This is to define that a book belongs to an author
Share:

Thursday, 13 June 2019

Useful terminal commands for MAC, Ubuntu or Windows

Search specific type of file in all folder

  • find ~ -type f -name '*pdf'
  • find ~ -iname '*pdf'

Search specific type of file in current folder
  • find . -iname '*pdf'
Make file executable
  • chmod +x file.xx'
Run PHPFixer on current folder
  • php-cs-fixer fix --diff --dry-run --stop-on-violation -v --using-cache=no
  • php-cs-fixer fix --stop-on-violation -v --using-cache=no
Make your git branch prefix
  • curl https://gist.githubusercontent.com/bartoszmajsak/1396344/raw/bff6973325b159254a3ba13c5cb9ac8fda8e382b/prepare-commit-msg.sh > .git/hooks/prepare-commit-msg && chmod u+x .git/hooks/prepare-commit-msg

Share:

Monday, 27 May 2019

Country Package for Laravel

It is often or not we need a country listing in our package to display in the view or dropdown HTML component. Instead of creating table of coutries we could use a proven PHP package library to do that.

I come across this library league/iso3166 and have use it ever since.

Methods you can use are:
Share:

Popular Posts

Recent Posts

Pages

Powered by Blogger.

About Me

My photo
For the past 10 years, I've been playing with codes using PHP, Java, Rails. I do this for a living and love new things to learn and the challenges that comes with it. Besides programming I love spending time with friends and family and can often be found together catching the latest movie or planning a trip to someplace I've never been before.