Basic

Registrations

Introduction

Registration and authentication are mandatory in any application when you have little concern about privacy.

In VaahCms, the purpose of Registration is to prevent duplicate entries in Users table.


Create Registration

Visit following url you will see the Registration section:

<project-url>/backend#/vaah/registrations/
registration

Now you have to create a Registration Entry by click on Create button. You will see a create page with following field.

registration

Fill all Fields. Click on Save button.

registration

Now you can see the detail in View Page.


Function to call to Create Registration

You can create a Registration by call the postCreate()method of RegistrationController at WebReinvent\VaahCms\Http\Controllers.

RegistrationController.php

<?php

namespace WebReinvent\VaahCms\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use WebReinvent\VaahCms\Entities\Registration;

class RegistrationsController extends Controller
{

    public $theme;

    //----------------------------------------------------------
    public function __construct()
    {
        $this->theme = vh_get_backend_theme();
    }
    //----------------------------------------------------------
    ............
    ............
    ............
    //----------------------------------------------------------
    public function postCreate(Request $request)
    {

        if(!\Auth::user()->hasPermission('can-create-registrations'))
        {
            $response['status'] = 'failed';
            $response['errors'][] = trans("vaahcms::messages.permission_denied");

            return response()->json($response);
        }

        $response = Registration::create($request);

        if($response['status'] == 'success')
        {
            $list = Registration::getList($request);
            $response['data']['list'] = $list['data']['list'];
        }

        return response()->json($response);
    }
    //----------------------------------------------------------

}


Copyright © 2024