In this repository you can find 2 branches:
- main: the laravel installation I used that has already the user.edit view.
- livewire_update_user: the code with the Livewire component added.
YouTube video: add url here
You can access to the homestead database using MySQLWorkbench or Sequel Ace (Sequel Ace is the "sequel" to longtime macOS tool Sequel Pro.)
I suggest to use Sequel Ace instead of Sequel Pro since Sequel Pro may have problems connecting to the Homestead database.
Connect using SSH and this parameters:
MySQL host: 127.0.0.1
Database user: homestead
Database password: secret
Database: homestead
SSH host: 192.168.10.10 (unless you changed it in Vagrantfile)
SSH user: vagrant
SSH password: vagrant
Then create the database agiledrop_livewire_talk
Clone this repo into a local folder:
git clone git@github.com:davide-casiraghi/livewire_agiledrop_talk.git
Copy & customize your .env config:
cp .env.example .env
nano .env
Config the .env like this:
DB_CONNECTION=mysql
DB_HOST=192.168.10.10
DB_PORT=3306
DB_DATABASE=agiledrop_livewire_talk
DB_USERNAME=homestead
DB_PASSWORD=secret
Add configuration to the Homestead.yaml file. (Homestead installed globally)
cd ~/Homestead
sudo nano Homestead.yaml
And here add:
folders:
- map: .... absolute path of the local folder related to your git repo...
to: /home/vagrant/code/livewire_agiledrop_talk
sites:
- map: livewire_agiledrop_talk.local
to: /home/vagrant/code/livewire_agiledrop_talk/public
php: "7.4"
To start the virtual machine:
cd ~/Homestead
vagrant up
Install vendor files:
composer install
Generate a unique app key by the following command:
php artisan key:generate
The key will be added to your .env file:
APP_KEY=
Run the db migrations:
php artisan migrate
Clean the cache:
php artisan cache:clear
Open the hosts file on your machine in your text editor and add this entry.
192.168.10.10 livewire_agiledrop_talk.local
Install all npm modules:
npm install
Create the file storage symbolic link from public/storage to storage/app/public
php artisan storage:link
Access the local website at:
https://livewire_agiledrop_talk.local/
If you are using PHPStorm you can generate the users data with this plugin:
https://plugins.jetbrains.com/plugin/14957-laravel-tinker
Once the plugin is installed in phpstorm.
- From the console empty the database and run the seeders
php artisan migrate:fresh && php artisan db:seed
- Press ctrl+Shift+T
- Paste the following code
- Press again ctrl+Shift+T to execute the code
<?php
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\Sequence;
$user = User::factory()->create([
'name' => "Davide Casiraghi",
'email' => 'davide.casiraghi@gmail.com',
]);
User::factory()->count(4)->create();