Support the ongoing development of Laravel.io →
Configuration Forms Validation
Last updated by @deepakgupta387 11 months ago.
0

Hello @deepakgupta387,

Have you verified that your App\User model implements the Illuminate\Contracts\Auth\MustVerifyEmail contract, as shown below:

class User extends Authenticatable implements MustVerifyEmail

And also have you enabled the email verification route in your web.php file as shown below:

Auth::routes(['verify' => true]);

Here is an article that you can follow to send email verification to the newly registered users.Example

Here is also the link to the official documentation Email Verification

Thanks.

Last updated 11 months ago.
0

Hi Faisal, Thank you for your prompt reply, I have followed your step and verified that App\User model implements the Illuminate\Contracts\Auth\MustVerifyEmail contract, as shown in your code. `namespace App;

use App\Http\Helpers\OtherHelper;

use Illuminate\Contracts\Auth\MustVerifyEmail;

use Illuminate\Foundation\Auth\User as Authenticatable;

use Illuminate\Notifications\Notifiable;

use Illuminate\Database\Eloquent\SoftDeletes;

class User extends Authenticatable implements MustVerifyEmail {`

Also, I enabled the email verification route in web.php. But still the same issue. Verification email not sent to the user end. Kindly help me out of this issue.

Thanks

Last updated 11 months ago.
0

Are you using Laravel's default email verification or you have built your own logic for the same?

0

I don't have extensive expertise in Laravel. Someone has developed the site. As per my research, there is a custom email verification. What you need from my end please let me know. I will try to provide you. I am sharing our web.php code below.

Route::get('/clear', function () {
    $exitCode = '';
    $exitCode .= Artisan::call('config:clear');
    $exitCode .= Artisan::call('cache:clear');
    $exitCode .= Artisan::call('config:cache');
    $exitCode .= Artisan::call('view:clear');
    return redirect()->back();
    // return what you want
});

// Frontend Routes

Route::group(['namespace' => 'frontend'], function () {
    Route::match(['get'], '/', [
        'uses'  => 'Pages@index',
        'as'    => 'Home'
    ]);
    Route::match(['get'], '/video-gallery/{category_id?}', [
        'uses'  => 'Video@videoGallery',
        'as'    => 'videogallery'
    ]);

   
    Route::match(['get'], '/contact-us', [
        'uses'  => 'Contactus@index',
        'as'    => 'contactus'
    ]);

    Route::match(['get'], '/practice', [
        'uses'  => 'Practice@index',
        'as'    => 'practice'
    ]);

    Route::match(['get','post'], '/findphysicianlocation/{locationView?}', [
        'uses'  => 'FindPhysicianLocation@index',
        'as'    => 'findPhysicianLocation'
    ]);

    Route::group(['namespace' => 'auth','middleware' => ['guest', 'web'] ], function () {

        Route::match(['get','post'], '/login', [
            'uses'  => 'LoginController@getlogin',
            'as'    => 'patientLogin'
        ]);
        Route::match(['get','post'], '/forgotpassword', [
            'uses'  => 'ForgotPassword@getForgotPassword',
            'as'    => 'patientForgotPassword'
        ]);
        Route::match(['get','post'], '/changepassword', [
            'uses'  => 'ForgotPassword@getChangePassword',
            'as'    => 'patientChangePassword'
        ]);
        Route::match(['get','post'], '/signup', [
            'uses'  => 'RegistrationController@create',
            'as'    => 'patientSignup',
        ]);

    });

    Route::match(['get', 'post'], '/emailverification', [
        'uses' => 'auth\EmailVerificationController@getverify',
        'as' => 'getverify'
    ]);
});

// Frontend videoprotected & patient

Route::group([ 'middleware' => [ 'videoprotected'],  'namespace' => 'frontend'],function(){

    Route::match(['get'],'/video-details/{video_id}',[
        'uses'  => 'Video@videDetails',
        'as'    => 'videdetails'
    ]);

});


Route::group([ 'middleware' => [ 'patient'],  'namespace' => 'frontend'],function(){

    Route::match(['get', 'post'], '/profile', [
        'uses' => 'Profile@index',
        'as' => 'userprofile'
    ]); 
    Route::match(['get', 'post'], '/logout', [
        'uses' => 'auth\LogoutController@getLogout',
        'as' => 'getLogout'
    ]);

});

// Frontend AjaxController

Route::group([], function () {

    Route::match(['post'], '/trackingvideoview', [
        'uses'  => 'AjaxController@trackingVideoView',
        'as'    => 'trackingvideoview'
    ]);
    Route::match(['post'], '/updatetrackingvideoview', [
        'uses'  => 'AjaxController@updateTrackingVideoView',
        'as'    => 'updatetrackingvideoview'
    ]);
    Route::match(['post'], '/updatevideorating', [
        'uses'  => 'AjaxController@updateVideoRating',
        'as'    => 'updatevideorating'
    ]);
    Route::match(['post'], '/getfeedbackform', [
        'uses'  => 'AjaxController@getFeedbackForm',
        'as'    => 'getfeedbackform'
    ]);

    Route::match(['post'], '/sendemail', [
        'uses'  => 'AjaxController@contactus',
        'as'    => 'sendemail'
    ]);
    Route::match(['post'], '/getfeaturedvideos', [
        'uses'  => 'AjaxController@getFeaturedVideos',
        'as'    => 'getfeaturedvideos'
    ]);

    Route::match(['post'], '/getallvideos', [
        'uses'  => 'AjaxController@getAllVideos',
        'as'    => 'getallvideos'
    ]);
    Route::match(['post'], '/getcategoryvideo', [
        'uses'  => 'AjaxController@getCategoryVideo',
        'as'    => 'getcategoryvideo'
    ]);
    Route::match(['post'], '/getgalleryvideos', [
        'uses'  => 'AjaxController@getGalleryVideos',
        'as'    => 'getgalleryvideos'
    ]);
    Route::match(['post'], '/getallcategoryvideo', [
        'uses'  => 'AjaxController@getAllCategoryVideo',
        'as'    => 'getallcategoryvideo'
    ]);
    Route::match(['post'], '/getsidevideos', [
        'uses'  => 'AjaxController@getSideVideos',
        'as'    => 'getsidevideos'
    ]);
    Route::match(['post'], '/userpagestracking', [
        'uses'  => 'AjaxController@ajaxuserPagesTracking',
        'as'    => 'userpagestracking'
    ]);
    Route::match(['post'], '/usertrackingupdate', [
        'uses'  => 'AjaxController@ajaxUserTrackingUpdate',
        'as'    => 'usertrackingupdate'
    ]);
    Route::match(['post'], '/userexternalurl', [
        'uses'  => 'AjaxController@ajaxUserExternalUrl',
        'as'    => 'userexternalurl'
    ]);
    Route::match(['post'], '/ajaxgetneareastlocation', [
        'uses'  => 'AjaxController@ajaxGetNeareastLocation',
        'as'    => 'ajaxgetneareastlocation'
    ]);
    Route::match(['get', 'post'], '/getcities/{is_ajax?}', [
        'uses'  => 'AjaxController@getCities',
        'as'    => 'AjaxController.getcities',
    ]);
    Route::match(['get', 'post'], '/getPhysicians/{is_ajax?}', [
        'uses'  => 'AjaxController@getPhysicians',
        'as'    => 'AjaxController.getPhysicians',
    ]);
    Route::match(['get', 'post'], '/getPrivacyPolicy/{is_ajax?}', [
        'uses'  => 'AjaxController@getPrivacyPolicy',
        'as'    => 'AjaxController.getPrivacyPolicy',
    ]);
    Route::match(['get', 'post'], '/getSignupPolicy/{is_ajax?}', [
        'uses'  => 'AjaxController@getSignupPolicy',
        'as'    => 'AjaxController.getSignupPolicy',
    ]);
    Route::match(['get', 'post'], '/getneareastnephrologist/{is_ajax?}', [
        'uses'  => 'AjaxController@ajaxGetNeareastNephrologist',
        'as'    => 'AjaxController.getneareastnephrologist',
    ]);
});


// SecureLogin Routes

Route::group(['middleware' => ['guest', 'web'], 'prefix' => 'securelogin', 'namespace' => 'securelogin'], function () {

    Route::match(['get', 'post'], '/', [
        'uses' => 'auth\LoginController@getLogin',
        'as' => 'getlogin'
    ]);

    Route::match(['get', 'post'], '/forgotPassword', [
        'uses' => 'auth\ForgotPassword@getForgotPassword',
        'as' => 'getforgotPassword'
    ]);
    Route::match(['get', 'post'], '/changepassword', [
        'uses' => 'auth\ForgotPassword@getChangePassword',
        'as' => 'getchangepassword'
    ]);
});


// SecureLogin AjaxController Routes

Route::group(['middleware' => ['admin']], function () {
    Route::match(['get', 'post'], '/sorting/{is_ajax?}', [
        'uses'  => 'AjaxController@sorting',
        'as'    => 'AjaxController.sorting',
    ]);
    Route::match(['get', 'post'], '/getvideodescription/{is_ajax?}', [
        'uses'  => 'AjaxController@getVideoDescription',
        'as'    => 'AjaxController.getVideoDescription',
    ]);
    Route::match(['get', 'post'], '/removecategory/{is_ajax?}', [
        'uses'  => 'AjaxController@removeCategory',
        'as'    => 'AjaxController.removeCategory',
    ]);
    Route::match(['get', 'post'], '/getlongnlat/{is_ajax?}', [
        'uses'  => 'AjaxController@getLongnLat',
        'as'    => 'AjaxController.getlongnlat',
    ]);
    Route::match(['get', 'post'], '/getaddress/{is_ajax?}', [
        'uses'  => 'AjaxController@getAddress',
        'as'    => 'AjaxController.getaddress',
    ]);
    Route::match(['get', 'post'], '/getpracticelocation/{is_ajax?}', [
        'uses'  => 'AjaxController@getPracticeLocation',
        'as'    => 'AjaxController.getpracticelocation',
    ]);
    Route::match(['get', 'post'], '/getpracticephysician/{is_ajax?}', [
        'uses'  => 'AjaxController@getPracticePhysician',
        'as'    => 'AjaxController.getpracticephysician',
    ]);
});

// SecureLogin Auth Route
Route::group(['middleware' => ['admin'], 'namespace' => 'securelogin', 'prefix' => 'securelogin'], function () {
    Route::get('/clear', function () {
        $exitCode = '';
        $exitCode .= Artisan::call('config:clear');
        $exitCode .= Artisan::call('cache:clear');
        $exitCode .= Artisan::call('config:cache');
        $exitCode .= Artisan::call('view:clear');
        return redirect()->back();
        // return what you want
    });

    Route::match(['get', 'post'], '/dashboard', [
        'uses' => 'dashboard\dashboard@view',
        'as' => 'dashboard'
    ]);

    Route::group(['namespace' => 'managepatients', 'prefix' => 'managepatients'], function () {
        Route::match(['get', 'post'], '/view/{view_filter?}', [
            'uses'  => 'Controls@view',
            'as'    => 'viewPatient',
        ]);
        Route::match(
            ['get'],
            '/changeStatus/{user_id}/{status}',
            [
                'uses' => 'Controls@changeStatus',
                'as' => 'changeStatus'
            ]
        );
    });

    Route::group(['namespace' => 'manageadminusers', 'prefix' => 'manageadminusers'], function () {
        Route::match(['get', 'post'], '/view/{view_filter?}', [
            'uses'  => 'Controls@view',
            'as'    => 'viewAdminuser',
        ]);
        Route::match(['get'], '/create', [
            'uses'  => 'Controls@create',
            'as'    => 'createAdminuser',
        ]);
        Route::match(['get'], '/edit/{edit_id}', [
            'uses'  => 'Controls@edit',
            'as'    => 'editAdminuser',
        ]);
        Route::match(['get'], '/delete/{delete_id}', [
            'uses'  => 'Controls@delete',
            'as'    => 'deleteAdminuser',
        ]);
        Route::match(['post'], '/save', [
            'uses'  => 'Controls@save',
            'as'    => 'saveAdminuser',
        ]);
    });
    Route::group(['namespace' => 'manageclinicalcommittee', 'prefix' => 'manageclinicalcommittee'], function () {
        Route::match(['get', 'post'], '/view/{view_filter?}', [
            'uses'  => 'Controls@view',
            'as'    => 'viewClinicalCommittee',
        ]);
        Route::match(['get'], '/create', [
            'uses'  => 'Controls@create',
            'as'    => 'createClinicalCommittee',
        ]);
        Route::match(['get'], '/edit/{edit_id}', [
            'uses'  => 'Controls@edit',
            'as'    => 'editClinicalCommittee',
        ]);
        Route::match(['get'], '/delete/{delete_id}', [
            'uses'  => 'Controls@delete',
            'as'    => 'deleteClinicalCommittee',
        ]);
        Route::match(['post'], '/save', [
            'uses'  => 'Controls@save',
            'as'    => 'saveClinicalCommittee',
        ]);
    });

    Route::group(['namespace' => 'managecategories', 'prefix' => 'managecategories'], function () {
        Route::match(
            ['get'],
            '/view/{view_filter?}',
            [
                'uses' => 'Controls@view',
                'as' => 'viewCategory'
            ]
        );
        Route::match(
            ['get'],
            '/edit/{edit_filter}',
            [
                'uses' => 'Controls@edit',
                'as' => 'editCategory'
            ]
        );
        Route::match(
            ['get'],
            '/delete/{delete_filter}',
            [
                'uses' => 'Controls@delete',
                'as' => 'deleteCategory'
            ]
        );
        Route::match(
            ['get'],
            '/create',
            [
                'uses' => 'Controls@create',
                'as' => 'createCategory'
            ]
        );
        Route::match(
            ['post'],
            '/save',
            [
                'uses' => 'Controls@save',
                'as' => 'saveCategory'
            ]
        );
        Route::match(
            ['post'],
            '/sorting',
            [
                'uses' => 'Controls@sorting',
                'as' => 'sortingCategory'
            ]
        );
        Route::match(
            ['post'],
            '/videoSorting',
            [
                'uses' => 'Controls@videoSorting',
                'as' => 'videoSortingCategory'
            ]
        );
    });

    Route::group(['namespace' => 'managepractices', 'prefix' => 'managepractices'], function () {
        Route::match(
            ['get'],
            '/view/{view_filter?}',
            [
                'uses' => 'Controls@view',
                'as' => 'viewPractice'
            ]
        );
        Route::match(
            ['get'],
            '/edit/{edit_filter}',
            [
                'uses' => 'Controls@edit',
                'as' => 'editPractice'
            ]
        );
        Route::match(
            ['get'],
            '/delete/{delete_filter}',
            [
                'uses' => 'Controls@delete',
                'as' => 'deletePractice'
            ]
        );
        Route::match(
            ['get'],
            '/create',
            [
                'uses' => 'Controls@create',
                'as' => 'createPractice'
            ]
        );
        Route::match(
            ['post'],
            '/save',
            [
                'uses' => 'Controls@save',
                'as' => 'savePractice'
            ]
        );
        Route::match(
            ['post'],
            '/sorting',
            [
                'uses' => 'Controls@sorting',
                'as' => 'sortingPractice'
            ]
        );
    });

    Route::group(['namespace' => 'managepracticelocation', 'prefix' => 'managepracticelocation'], function () {
        Route::match(
            ['get'],
            '/view/{view_filter?}',
            [
                'uses' => 'Controls@view',
                'as' => 'viewPracticesLocation'
            ]
        );
        Route::match(
            ['get'],
            '/edit/{edit_filter}',
            [
                'uses' => 'Controls@edit',
                'as' => 'editPracticesLocation'
            ]
        );
        Route::match(
            ['get'],
            '/delete/{delete_filter}',
            [
                'uses' => 'Controls@delete',
                'as' => 'deletePracticesLocation'
            ]
        );
        Route::match(
            ['get'],
            '/create',
            [
                'uses' => 'Controls@create',
                'as' => 'createPracticesLocation'
            ]
        );
        Route::match(
            ['post'],
            '/save',
            [
                'uses' => 'Controls@save',
                'as' => 'savePracticesLocation'
            ]
        );
        Route::match(
            ['post'],
            '/sorting',
            [
                'uses' => 'Controls@sorting',
                'as' => 'sortingPracticesLocation'
            ]
        );
    });
    Route::group(['namespace' => 'managephysician', 'prefix' => 'managephysician'], function () {
        Route::match(
            ['get'],
            '/view/{view_filter?}',
            [
                'uses' => 'Controls@view',
                'as' => 'viewPhysician'
            ]
        );
        Route::match(
            ['get'],
            '/edit/{edit_filter}',
            [
                'uses' => 'Controls@edit',
                'as' => 'editPhysician'
            ]
        );
        Route::match(
            ['get'],
            '/delete/{delete_filter}',
            [
                'uses' => 'Controls@delete',
                'as' => 'deletePhysician'
            ]
        );
        Route::match(
            ['get'],
            '/create',
            [
                'uses' => 'Controls@create',
                'as' => 'createPhysician'
            ]
        );
        Route::match(
            ['post'],
            '/save',
            [
                'uses' => 'Controls@save',
                'as' => 'savePhysician'
            ]
        );
        Route::match(
            ['post'],
            '/sorting',
            [
                'uses' => 'Controls@sorting',
                'as' => 'sortingPhysician'
            ]
        );
    });

    Route::group(['namespace' => 'practicelocations', 'prefix' => 'practicelocations'], function () {
        Route::match(
            ['get'],
            '/view/{view_filter?}',
            [
                'uses' => 'Controls@view',
                'as' => 'viewPracticeLocations'
            ]
        );
        Route::match(
            ['get'],
            '/edit/{edit_filter}',
            [
                'uses' => 'Controls@edit',
                'as' => 'editPracticeLocations'
            ]
        );
        Route::match(
            ['get'],
            '/delete/{delete_filter}',
            [
                'uses' => 'Controls@delete',
                'as' => 'deletePracticeLocations'
            ]
        );
        Route::match(
            ['get'],
            '/create',
            [
                'uses' => 'Controls@create',
                'as' => 'createPracticeLocations'
            ]
        );
        Route::match(
            ['post'],
            '/save',
            [
                'uses' => 'Controls@save',
                'as' => 'savePracticeLocations'
            ]
        );
        Route::match(
            ['post'],
            '/sorting',
            [
                'uses' => 'Controls@sorting',
                'as' => 'sortingPracticeLocations'
            ]
        );
    });

    Route::group(['namespace' => 'managevideo', 'prefix' => 'managevideo'], function () {
        Route::match(
            ['get'],
            '/view/{view_filter?}',
            [
                'uses' => 'Controls@view',
                'as' => 'viewVideos'
            ]
        );
        Route::match(
            ['get'],
            '/edit/{edit_filter}',
            [
                'uses' => 'Controls@edit',
                'as' => 'editVideo'
            ]
        );
        Route::match(
            ['get'],
            '/delete/{delete_filter}',
            [
                'uses' => 'Controls@delete',
                'as' => 'deleteVideo'
            ]
        );
        Route::match(
            ['get'],
            '/create',
            [
                'uses' => 'Controls@create',
                'as' => 'createVideo'
            ]
        );
        Route::match(
            ['post'],
            '/save',
            [
                'uses' => 'Controls@save',
                'as' => 'saveVideo'
            ]
        );
    });

    Route::group(['namespace' => 'manageprofile', 'prefix' => 'manageprofile'], function () {
        Route::match(['get'], '/profile/{profile_id}', [
            'uses' => 'Controls@getProfile',
            'as' => 'get.profile'
        ]);
        Route::match(
            ['post'],
            '/save',
            [
                'uses' => 'Controls@save',
                'as' => 'saveProfile'
            ]
        );
    });

    Route::group(['namespace' => 'manageslider', 'prefix' => 'manageslider'], function () {
        Route::match(
            ['get'],
            '/view/{view_filter?}',
            [
                'uses' => 'Controls@view',
                'as' => 'viewSlider'
            ]
        );
        Route::match(
            ['get'],
            '/edit/{edit_filter}',
            [
                'uses' => 'Controls@edit',
                'as' => 'editSlider'
            ]
        );
        Route::match(
            ['get'],
            '/delete/{delete_filter}',
            [
                'uses' => 'Controls@delete',
                'as' => 'deleteSlider'
            ]
        );
        Route::match(
            ['get'],
            '/create',
            [
                'uses' => 'Controls@create',
                'as' => 'createSlider'
            ]
        );
        Route::match(
            ['post'],
            '/save',
            [
                'uses' => 'Controls@save',
                'as' => 'saveSlider'
            ]
        );
        Route::match(
            ['post'],
            '/sorting',
            [
                'uses' => 'Controls@sorting',
                'as' => 'sortingSlider'
            ]
        );
    });


    Route::match(['get', 'post'], '/logout', [
        'uses' => 'auth\LogoutController@getLogout',
        'as' => 'get.Logout'
    ]);

    Route::group(['namespace' => 'cms', 'prefix' => 'cms'], function () {
        Route::match(
            ['get'],
            '/page/{page}', [
                'uses' => 'Controls@page',
                'as' => 'page.get'
            ]
        );
        Route::match(
            ['post'],
            '/save/{page}', [
                'uses' => 'Controls@save',
                'as' => 'page.save'
            ]
        );
    });

    Route::get('/laravel-filemanager', '\UniSharp\LaravelFilemanager\Controllers\LfmController@show');
    Route::post('/laravel-filemanager/upload', '\UniSharp\LaravelFilemanager\Controllers\UploadController@upload');
});

// CMS Route

Route::group( ['namespace' => 'frontend' ],function(){
    Route::get('{slug}', [
        'uses' => 'Pages@index',
        'as' => 'pages',
    ])
    ->where('slug', '([A-Za-z0-9\-]+)');

});
Last updated 11 months ago.
0

Here is my controller.

<?php
namespace App\Http\Controllers;

use App\Http\Helpers\OtherHelper;
use App\Http\Library\RoleManagement;
use FFMpeg;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Str;
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

use Validator;

class MY_Controller extends Controller
{
    function __construct()
    {
        $this->middleware(function ($request, $next) {

            return $next($request);
        });
    }

    public function _auth_current_logged_in_ID($compare_with, $guard = "")
    {
        if (\Auth::guard($guard)->check()) {
            if ($compare_with == \Auth::guard($guard)->ID()) {
                return TRUE;
            }
        }


        return FALSE;
    }

    public function default_data()
    {

        $data["TRACKING_INTERVAL"]                                  = Config::get('constants.TRACKING_INTERVAL');
        $data["SITE_KEY"]                                           = Config::get('constants.SITE_KEY');
        $data["admin_path"]                                         = "securelogin/";
        $data["front_path"]                                         = "frontend/";
        $data["frontend_path"]                                      = "account/";

        $data["video_dir"]                                          = "public/files/video/listing/";
        $data["image_dir"]                                          = "public/files/practice/images/";
        $data["slider_dir"]                                         = "public/files/slider/";
        $data["image_dir_load"]                                     = "files/practice/images/";
        $data["video_DirView"]                                      = "/files/video/listing/";
        $data["thumbnail_dir"]                                      = Config::get('constants.THUMBNAIL_URL');

        $data['video_types']                                        = "mp4";
        $data['video_mime_types']                                   = [ 'video/mp4' ];

        $data['image_types']                                        = "png,jpeg,jpg,bmp";
        $data['image_mime_types']                                   = ['image/jpeg','image/bmp','image/png'];

        $data["_directory"]                                         = "";
        $data["_heading"]                                           = "";
        $data["_pagetitle"]                                         = "";
        $data["_pageview"]                                          = "";

        $data['_messageBundle']                                     = $this->_messageBundle('', '');

        $data['dataTableDOM_PARENT']                                = $this->getDataTableDOM();
        $data['dataTableDOM_CHILD']                                 = $this->getDataTableDOM();


        $data['dataTableLENGTH_PARENT']                             = $this->getDataTableLENGTH();
        $data['dataTableLENGTH_CHILD']                              = $this->getDataTableLENGTH();


        $data['_messageBundle_unauthorized']                        = $this->_messageBundle('danger', trans("general_lang.not_authorized_message"), trans("general_lang.not_authorized_heading"));

        $this->default_data_extend($data);

        $max_upload                                                 = ini_get('upload_max_filesize');
		$data["max_upload_validate"]                                = str_replace('M', '', $max_upload);
		$data["max_upload"]                                         = $data["max_upload_validate"].'MB' ;

        return  $data;
    }
    public function default_data_extend(&$data)
    {
        $data['datatable_properties']                = FALSE;
        return $data;
    }

    static function getDataTableLENGTH()
    {
        return     json_encode([[10, 25, 50, -1], [10, 25, 50, "All"]]);
    }

    public function _messageBundle($class = FALSE, $msg = FALSE, $heading = '', $jAlert = false, $inline_alert = false)
    {

        $data['_ALERT_mode']            = "";
        $data['_call_name']                = "";
        $data['_redirect_to']            = "";
        $TMP_messages                     = "";

        if ($heading == "use_as_ajax_content") {
            $msg                                = $msg;
        } else {
            if (is_object($msg)) {
                #$TMP_messages                   = "<ul>";


                foreach ($msg->all() as $a => $message) {

                    $TMP_messages               .= "<p>" . $message . "</p>";
                }
                #$TMP_messages                   .= "</ul>";
                $msg                            = $TMP_messages;
            } else if (is_array($msg)) {
                foreach ($msg as $a => $message) {

                    $TMP_messages               .= "<p>" . $message . "</p>";
                }

                $msg                            = $TMP_messages;
            }
        }


        if ($jAlert and !$inline_alert) {
            $data['_ALERT_mode']            = "inline";
            $data['_CSS_show_messages']        = $class;
            $data['_TEXT_show_messages']    = $msg;
            $data['_HEADING_show_messages']    = $heading;

            return $data;
        } else if ($inline_alert) {



            Session::flash('_flash_data_inline', TRUE);
            Session::flash('_flash_messages_type', $class);
            Session::flash('_flash_messages_content', $msg);
            Session::flash('_flash_messages_title', $heading);
        } else {

            $data['_CSS_show_messages']        = $class;
            $data['_TEXT_show_messages']    = $msg;
            $data['_HEADING_show_messages']    = $heading;

            return $data;
        }
    }

    static function getDataTableDOM($custom_syntax = false, $other_syntax = false, $show_custom_datatable_loader = TRUE)
    {
        if ($custom_syntax) {
            $MultiArray            = $custom_syntax;
        } else {
            $MultiArray            = array(
                array(
                    array(
                        "size"        => 6,
                        "value"        => "l"
                    ),

                    array(
                        "size"        => 6,
                        "value"        => "f"
                    )
                ),


                array(
                    array(
                        "size"        => 6,
                        "value"        => "i"
                    ),

                    array(
                        "size"        => 6,
                        "value"        => "p"
                    )
                ),

                array(
                    array(
                        "size"        => 12,
                        "value"        => "t"
                    ),

                    array(
                        "size"        => 12,
                        "value"        => "r"
                    )
                ),

                array(
                    array(
                        "size"        => 6,
                        "value"        => "i"
                    ),

                    array(
                        "size"        => 6,
                        "value"        => "p"
                    )
                ),


            );
        }


        $syntax_code        = '';
        foreach ($MultiArray as $i => $v) {

            $syntax_code        .= '<"row"';
            foreach ($v as $index => $value) {
                if ($value['value'] == "r" and $show_custom_datatable_loader) {
                    $syntax_code    .= '<"col-sm-' . $value['size'] . ' datatTable_lock_loader"' . $value['value'] . '>';
                } else {
                    $syntax_code    .= '<"col-sm-' . $value['size'] . '"' . $value['value'] . '>';
                }
            }
            $syntax_code        .= ">";
        }



        return  $syntax_code;
    }

    public function uploadUserFile($request, &$validator, array $config_controls = [], $thumb_controls, array $other_controls = null, bool $BOOL = FALSE,$is_video = true)
    {
        if($is_video)
        {
            $videoFIle                                       = File::allFiles(public_path($this->data['video_DirView']));
        }

        $upload_file_array                             = [];
        $destinationPath                                = $config_controls['upload_path'];
        $input_field                                    = $other_controls["input_field"];

        $_POST[$input_field]                            = $input_field;

        if (!array_key_exists('id', $other_controls))
        {
            $other_controls['id']                   = strtotime("now");
        }

        if (!array_key_exists('validate', $other_controls))
        {
            $other_controls['validate']             = FALSE;
        }

        if (!array_key_exists('db_field', $other_controls))
        {
            $other_controls['db_field']             = "";
        }

        if (!array_key_exists('hdn_field', $other_controls))
        {
            $other_controls['hdn_field']            = "";
        }

        if (!array_key_exists('input_nick', $other_controls))
        {
            $other_controls['input_nick']           = "";
        }

        if (!array_key_exists('only_validate', $other_controls))
        {
            $other_controls['only_validate']        = FALSE;
        }

        $saveData['id']                             = $other_controls['id'];
        $db_field                                   = $other_controls['db_field'];
        $FILE_uploaded                              = TRUE;
        $fileName                                   = null;


        $file                                       = [
            $other_controls["hdn_field"] => Request::file($input_field)
        ];
        $rule_set = $other_controls['validate'] . '|mimes:' . $config_controls['allowed_types'];



        if (isset($other_controls['allowed_mime_types']))
        {
            $rule_set            .= '|mimetypes:' . $config_controls['allowed_mime_types'];
        }

        $rules                  = [
                                    $other_controls["hdn_field"] => $rule_set
                                    ];
        $file_validation = Validator::make($file, $rules);

        $input_labelName = [
                                $other_controls["hdn_field"]            => $other_controls['input_nick']
                            ];

        $file_validation->setAttributeNames($input_labelName);

        if ($file_validation->fails())
        {
            $upload_file_array             = [
                                                    "error"         => 3,
                                                    "reason"        => "upload_error",
                                                    "msg"           => $validator->messages()
                                                ];

            $validator->after(
                function ($validator) use ($other_controls, $file_validation)
                {
                    $validator
                        ->errors()
                        ->add($other_controls["hdn_field"], $file_validation->errors()->first($other_controls["hdn_field"]));
                }
            );
        }
        else {

            if ($other_controls['only_validate'])
            {
                $upload_file_array     = [
                                            "error"             => 1,
                                            "reason"            => "pass",
                                            "hdn_array"         => "Only Validate"
                                        ];
            }
            else if (Request::file($input_field) == NULL)
            {
                $FILE_uploaded                          = FALSE;
            }
            else if (Request::file($input_field)->isValid())
            {
                $extension                  = Request::file($input_field)->getClientOriginalExtension();
                $fileName                   = Request::file($input_field)->getClientOriginalName();
                $ext                        = pathinfo($fileName, PATHINFO_EXTENSION);
                $fileName                   = basename($fileName, "." . $ext);
                $fileName                   = Str::slug($fileName);
                $thumbnail_name              = $fileName . '-' . time();

                if (isset($config_controls['encrypt_name']) && $config_controls['encrypt_name'] == TRUE) {

                    $fileName = $fileName . '-' . time() . '.' . $extension;
                } else {

                    $fileName = $fileName . '.' . $extension;
                }
                $TMP_input              = Request::file($input_field)->move(base_path($destinationPath), $fileName);

                if($is_video)
                {
                    $this->generateThumbnailWithVideoDetials($fileName, $this->data, $thumbnail_name);
                }

                $videoData                = [$other_controls["db_field"] => $destinationPath . $TMP_input->getBasename()];

                $upload_file_array     = [
                                            "error"             => 1,
                                            "reason"            => "pass",
                                            "hdn_array"         => $videoData
                                        ];
            } else {
                $upload_file_array     = [
                                            "error"             => 3,
                                            "reason"            => "upload_error",
                                            "msg"               => $other_controls["input_nick"] . " is not Valid"
                                        ];


                $validator->after(
                    function ($validator) use ($other_controls, $file_validation, $upload_file_array)
                    {
                        $validator
                            ->errors()
                            ->add($other_controls["hdn_field"], $upload_file_array["msg"]);
                    }
                );
            }
        }



        if (!$FILE_uploaded) {


            if ($request[$other_controls['hdn_field']] != '')
            {
                $videoData                        = [
                    $db_field   => $request[$other_controls['hdn_field']],
                    'id'        => @$saveData['id']
                ];


                $upload_file_array            =    [
                                                        "error"         =>    2,
                                                        "reason"        =>   "hidden",
                                                        "hdn_array"     =>    $videoData
                                                    ];
            }
            else if ($other_controls['validate'])
            {

                $upload_file_array            =    [
                                                        "error"         => 3,
                                                        "reason"        => "upload_error",
                                                        "msg"           => "The " . $other_controls["input_nick"] . " field is required"
                                                    ];



                $validator->after(
                    function ($validator) use ($other_controls, $file_validation, $upload_file_array) {
                        $validator
                            ->errors()
                            ->add($other_controls["hdn_field"], $upload_file_array["msg"]);
                    }
                );
            }
            else {

                $upload_file_array            = [
                                                    "error"             =>    0,
                                                    "reason"            =>  "none",
                                                    "msg"               =>    ''
                                                ];
            }
        }



        $upload_file_array["upload_path"]                  = $config_controls['upload_path'];
        $upload_file_array["hdn_field"]                    = $other_controls['hdn_field'];
        $upload_file_array["db_field"]                     = $other_controls['db_field'];
        $upload_file_array["tmp_table_field"]              = $other_controls['tmp_table_field'];
        $upload_file_array["file_name"]                    = $fileName;

        return $upload_file_array;
    }

    public function generateThumbnailWithVideoDetials($input_file = false, &$data, $fileName)
    {
        $fileName       = $fileName . '.jpg';
        $ffmpeg         = FFMpeg\FFMpeg::create();
        $video_Url      = base_path($this->data["video_dir"] . $input_file);
        $video          = $ffmpeg->open($video_Url);

        $ffprobe = FFMpeg\FFProbe::create();
        $totalSecs          = $ffprobe->format($video_Url)->get('duration');



        $frame = $video->frame(FFMpeg\Coordinate\TimeCode::fromSeconds((ceil($totalSecs) / 2)))
            ->save(base_path($this->data["thumbnail_dir"] . $fileName));



        $video_dimensions = $ffprobe
                                ->streams($video_Url)
                                ->videos()
                                ->first()
                                ->getDimensions();

        $width      = $video_dimensions->getWidth();
        $height     = $video_dimensions->getHeight();


        $data['thumbnail_file']     = $fileName;
        $data['width']              = $width;
        $data['height']             = $height;
        $data['duration']           = OtherHelper::getDuration($totalSecs);
        $data['video_file']         = $input_file;
    }

    public function tmp_record_uploads_in_db($request, $linked_with_path, $tmp_upload_video_1 = array(), $is_multiple = FALSE)
    {


        if ($tmp_upload_video_1["error"] == "1" and $tmp_upload_video_1["reason"] == "pass") {

            $tmp_record                 = Tmp_Videos_Upload::where("unique_formid", $request["unique_formid"]);

            $i                          = $tmp_upload_video_1["hdn_array"][$tmp_upload_video_1["db_field"]];

            if ($linked_with_path) {
                $i                    = $tmp_upload_video_1["upload_path"] . $tmp_upload_video_1["hdn_array"][$tmp_upload_video_1["db_field"]];
            }


            if ($tmp_record->count() > 0) {

                $insert_id                = $tmp_record->get()->first();


                $insert_upload_file        = [
                    $tmp_upload_video_1["tmp_table_field"]                  => $i,
                    "unique_formid"                                         => $request["unique_formid"]
                ];


                $saveData = Tmp_Videos_Upload::where([
                    'id'    => $insert_id
                ])
                    ->update($insert_upload_file);


                $request->request->add([$tmp_upload_video_1["hdn_field"] => $i]);
            } else {


                $insert_upload_file        = [
                    $tmp_upload_video_1["tmp_table_field"]            => $i,
                    "unique_formid"                                   => $request["unique_formid"]
                ];

                $TT = new Tmp_Videos_Upload();
                $__UPLOAD_FIELD            =  $tmp_upload_video_1["tmp_table_field"];


                $TT->$__UPLOAD_FIELD                                        = $i;
                $TT->unique_formid                                          = $request["unique_formid"];

                if ($tmp_upload_video_1["tmp_table_field"] == "upload_2") {
                    $TT->upload_1                = "";
                }
                if ($tmp_upload_video_1["tmp_table_field"] == "upload_1") {
                    $TT->upload_2                = "";
                }

                $TT->save();


                $request->request->add([$tmp_upload_video_1["hdn_field"] => $i]);
            }
        }
    }


    public function email($e)
    {

            try {

                
                $mail                              = new PHPMailer();

                $mail->IsSMTP();
                $mail->SMTPDebug                   = false;
                $mail->Host                        = Config::get('constants.MAIL_HOST');
                $mail->SMTPAuth                    = true;
                $mail->Username                    = Config::get('constants.MAIL_USERNAME');
                $mail->Password                    = Config::get('constants.MAIL_PASSWORD');
                $mail->SMTPSecure                  = Config::get('constants.MAIL_ENCRYPTION');
                $mail->Port                        = Config::get('constants.MAIL_PORT');
                $mail->setFrom(Config::get('constants.MAIL_FORM'), $e['from_name']);
                       
                
          
                $mail->IsHTML(true);

                $mail->Subject                    = $e['subject'];

                if ($e['email_attachment'] != "") {
                    $mail->AddAttachment($e['email_attachment']);
                }

                $mail->MsgHTML($e['message']);



                if (is_array($e['to'])) {
                    if (count($e['to']) > 0) {
                        foreach ($e['to'] as $to_email) {
                            if ($to_email != '') {
                                $mail->AddAddress(trim($to_email));
                            }
                        }
                    }
                } else {
                    $mail->AddAddress($e['to']);
                }




                if (is_array($e['bcc'])) {
                    if (count($e['bcc']) > 0) {
                        foreach ($e['bcc'] as $bcc_email) {
                            if ($bcc_email != '') {
                                $mail->AddBCC(trim($bcc_email));
                            }
                        }
                    }
                } else {
                    $mail->AddBCC($e['bcc']);
                }
                $a = $mail->Send();

                return TRUE;
            } catch (phpmailerException $e) { } catch (Exception $e) {

                    
                return false;
            }

    }

    public function sendEmail($email_template)
    {
        if (!isset($email_template["email_heading"])) {
            $email_template["email_heading"]        = "";
        }

        if (!isset($email_template["email_to"])) {
            $email_template["email_to"]                = Config::get('constants.EMAIL_TO');
        }

        if (!isset($email_template["email_from"])) {
            $email_template["email_from"]            = Config::get('constants.MAIL_FORM');
        }

        if (!isset($email_template["email_from_name"])) {
            $email_template["email_from_name"]        = Config::get('constants.MAIL_FORMNAME');
        }

        if (!isset($email_template["email_post"])) {
            $email_template["email_post"]            = Request::all();
        }

        if (!isset($email_template["email_attachment"])) {
            $email_template["email_attachment"]        = "";
        }

        if (!isset($email_template["email_bcc"])) {
            $email_template["email_bcc"]            = Config::get('constants.EMAIL_BCC');
        }


        if (!isset($email_template["default_subject"])) {
            $email_template["default_subject"]        = "";
        } else {
            $email_template["default_subject"]        = Config::get('constants.EMAIL_SUBJECT')  . " - ";
        }

        if (isset($email_template["email_file_HTML"])) {
            $email_body                                = $email_template["email_file_HTML"];
        } else {

            $email_body                                    = view(Config::get('constants.EMAIL_TEMPLATE'), $email_template);
        }


        $email_array        =   [
                                    "from"                  => $email_template["email_from"],
                                    "from_name"             => $email_template["email_from_name"],
                                    "to"                    => $email_template["email_to"],
                                    "cc"                    => "",
                                    "bcc"                   => $email_template["email_bcc"],
                                    "subject"               => $email_template["default_subject"] . $email_template["email_subject"],
                                    "email_attachment"      => $email_template["email_attachment"],
                                    "message"               => ($email_body)
                                ];


        if (isset($email_template["debug"])) {
            echo $email_body;
            dd($email_array);
            die;
        }

        return $this->email($email_array);
    }

    public function userPagesTracking($tracked_url = null)
    {

        $IpAddress              = Request::getClientIp(true);
        $url                    = ( $tracked_url ==  null ? Request::url() : $tracked_url );
        $TimeSpentOnPage        = OtherHelper::getCurrentDate();
        $tempSecs               = 0 ;

        $usertrackingdata                    =  new  \App\UserPageView();
        $usertrackingdata->IpAddress         = $IpAddress;
        $usertrackingdata->Url               = $url;
        $usertrackingdata->TimeSpentOnPage   = gmdate("H:i:s", (int) $tempSecs); //gmdate("H:i:s", (int) $tempSecs['s']);

        if( Auth::guard( 'patient' )->check() )
        {
            $UserID                              = RoleManagement::getUserLogggedInInfo()->UserID;
            $usertrackingdata->UserID            = $UserID;
        }else
        {
            $usertrackingdata->UserID            =  null;
        }

        $usertrackingdata->save();

        return $usertrackingdata->UserPageViewID;
    }

    public static function getCMSMenu()
    {
        $menu = \App\ContentFragment::all();
        return $menu;
    }
}

``

Last updated 11 months ago.
0

@tvbeek Sorry to bother you, but can you please update the above reply so that I can properly see the code. Thanks

0
moderator

@faisal No problem I have updated the posts.

@deepakgupta387 if you want to add a code block you can wrap it in 3 ` instead of 1 :)

faisal liked this reply

1

@deepakgupta387 you need to see the definition of the sendEmailVerificationNotification function that is invoked in the create method of the RegisterController

0

Bro Recently I faced issues for sending user verification email in API for use laravel default function. Then use custom code thats very simple . Now its works properly .

0

@developeralamin If the below code is what you have on your (.env) file; you need to fill in a proper SMTP mail credentials.

SMTP SETTING

MAIL_MAILER=smtp MAIL_HOST=mail.example.com MAIL_PORT=465 MAIL_USERNAME=[email protected] MAIL_PASSWORD=*********** MAIL_ENCRYPTION=ssl MAIL_FROM_ADDRESS=[email protected] MAIL_FROM_NAME="Your name" EMAIL_TO=[email protected] EMAIL_SUBJECT=Subject Here

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.