Skip to content

Qore frontend

This is the qore frontend documentation home page.

Installation

  1. Install the package via composer:
bash
composer require qore-works-business/qore-frontend
  1. Run the artisan install script to install the qore-frontend.
bash
php artisan qore-frontend:install

Scaffold a new portal application

To scaffold a new application based on the Portal template you can run:

shell
  php artisan scaffold:application Portal portal --create
  npm install
  npm run build

If route, config, or ServiceProviders already exist these won't be replaced with a newer version.
To redeploy the latest version of these files, you can add the --force flag.

Update User model

Make sure to add the trait HasWelcomeNotification to the user model so it wil receive notifications when creating a platform user from a Person inside the Admin.

Make sure to add the HasVerifyEmailNotification trait to the user model so it will receive an email to verify its email address before being allowed to access the platform.

php
use QoreWorksBusiness\QoreFrontend\Concerns\HasVerifyEmailNotification;
use QoreWorksBusiness\QoreFrontend\Concerns\HasWelcomeNotification;

class User extends QoreAdminBaseUser implements MustVerifyEmail
{
    use HasVerifyEmailNotification;
    use HasWelcomeNotification;
}

Adding middleware aliases

The frontend and routing ships with aliases for middleware as default, this makes using the correct middleware easy, without having to read config files.
Add the following snippet to bootstrap/app.php to setup the middleware.

php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Middleware;
use QoreWorksBusiness\QoreFrontend\QoreFrontendRouting;

return Application::configure()
    ->withMiddleware(function (Middleware $middleware) {
        QoreFrontendRouting::aliasPortalMiddleware($middleware);
    });

Alternatively the aliases can be added in a service provider using the following snippet.
Using the bootstrap/app.php is recommended but for some testing setups this doesn't work.

php
use Illuminate\Contracts\Http\Kernel;
use QoreWorksBusiness\QoreFrontend\QoreFrontendRouting;

// Add global middleware to Kernel. In projects, this is done in the bootstrap/app.php
$aliases = app(Kernel::class)->getMiddlewareAliases();
app(Kernel::class)->setMiddlewareAliases(QoreFrontendRouting::aliasPortalMiddleware($aliases));

Styling livewire components

The frontend package ships with a handful of livewire components, who's views are not published to projects by default.
The tailwind config should search the view files for tailwind classes already, but if styling issues occur, verify the following is included in the projects tailwind.config.js.

js
export default {
    content: {
        relative: true,
        files: [
            '../../../../vendor/qore-works-business/qore-frontend/resources/views/application/portal/**/*.blade.php',
        ],
    }
}

Customizing the packages views can be done by publishing them.

bash
php artisan vendor:publish --tag=qore-frontend-views

Alternatively, you can extend the livewire class and render your own view using the render() function.

php
use QoreWorksBusiness\QoreFrontend\Integrations\Portal\Livewire\auth\LoginCard

class Login extends LoginCard 
{
    public function render() 
    {
        return view('your-view')
    }
}