PHP code example of bastinald / ui

1. Go to this page and download the library: Download bastinald/ui library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bastinald / ui example snippets


use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Schema\Blueprint;

class User extends Model
{
    public function migration(Blueprint $table)
    {
        $table->id();
        $table->string('name');
        $table->string('email')->unique();
        $table->timestamp('email_verified_at')->nullable();
        $table->string('password');
        $table->rememberToken();
        $table->timestamp('created_at')->nullable();
        $table->timestamp('updated_at')->nullable();
    }
}

use Illuminate\Support\Facades\Route;
use Livewire\Component;

class Home extends Component
{
    public function route()
    {
        return Route::get('/home', static::class)
            ->name('home')
            ->middleware('auth');
    }
}

use Bastinald\Ui\Traits\HasHashes;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use HasHashes;

    protected $hashes = ['password'];
}

$this->getModel();

$this->getModel(['email', 'password']);

$this->getModel('first_name', 'Joe');

$this->setModel([
    'name' => 'Joe',
    'email' => '[email protected]',
]);

$this->setModel('name', 'Joe');

$this->resetModel();

public function rules()
{
    return [
        'email' => ['on login()
{
    $this->validateModel();
    
    // log the user in
}

public function login()
{
    $this->validateModel([
        'email' => ['

$this->emit('showModal', 'auth.password-change');

$this->emit('showModal', 'users.update', $user->id);

public $user;

public function mount(User $user)
{
    $this->user = $user;
}

$this->emit('hideModal');

'stub_path' => resource_path('stubs/vendor/ui'),
console
php artisan ui:install
console
php artisan ui:install
console
php artisan ui:model {class} {--force}
console
# no subfolder
php artisan ui:crud Users 

# in an "Admin" subfolder
php artisan ui:crud Admin/Users 
console
php artisan ui:migrate {--f|--fresh} {--s|--seed} {--force}
console
php artisan ui:model Vehicle
console
php artisan vendor:publish