Kaustubh

Kaustubh

Devloper at MInSysT Consulting Pvt. Ltd.

Mumbai

Member Since 1 Year Ago

Experience Points 8,540
Experience
Level
Lessons Completed 30
Lessons
Completed
Best Reply Awards 3
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

30 Oct
1 month ago

Kaustubh started a new conversation Multiple State Value Not Working In VUEX

Hi

This is my vuex (userStore.js) page

const state = {
    roles:null,
    authUser:null
}
const mutations  = {
    SET_AUTH_USER(state,userObj){
        state.authUser = userObj
    },
    SET_USER_ROLE(state,userRole){
        state.roles = userRole      
    }
}
const actions = {
    setUserObject :({commit},userObj) => {
        commit('SET_AUTH_USER',userObj)
    },
    setUserRoles :({commit},userRole) => {
        commit('SET_USER_ROLE',userRole)
    }
}
export default {
    state, mutations, actions
}

When i fetch data and dispatch to the sidebar page, and console store i get output like this sidebar.vue

console.log(this.$store.state.userStore)
// OUTPUT
// {__ob__: Observer}
// authUser: "NqStDm8ol3QGtoh0hzL7yhC3NP3HV0ktYKmYHI8TNiCjG4T4tLlv3pOEWFdA5CEh"
// roles: Array(3) 

console.log(this.$store.state.userStore.roles)
// (3) [{…}, {…}, {…}, __ob__: Observer]

console.log(this.$store.state.userStore.authUser)
// "NqStDm8ol3QGtoh0hzL7yhC3NP3HV0ktYKmYHI8TNiCjG4T4tLlv3pOEWFdA5CEh"

But Problem comes when i console it in dashboard or any other page i get output null in roles and value in authUser like given below

console.log(this.$store.state.userStore)
// OUTPUT
// {__ob__: Observer}
// authUser: "NqStDm8ol3QGtoh0hzL7yhC3NP3HV0ktYKmYHI8TNiCjG4T4tLlv3pOEWFdA5CEh"
// roles: Array(3)

console.log(this.$store.state.userStore.roles)
// null

console.log(this.$store.state.userStore.authUser)
// "NqStDm8ol3QGtoh0hzL7yhC3NP3HV0ktYKmYHI8TNiCjG4T4tLlv3pOEWFdA5CEh"

Kaustubh started a new conversation Define Multiple Variable In VUEX Mutation

store.js

import Vue from 'vue';
import Vuex from 'vuex';
import userStore from './user/userStore.js';
import VuexPersist  from "vuex-persistedstate";
Vue.use(Vuex)
const debug = process.env.NODE_ENV !== 'production'


const vuexLocalStorage = new VuexPersist({
  key: 'vuex', // The key to store the state on in the storage provider.
  storage: window.localStorage, // or window.sessionStorage or localForage
})

export default new Vuex.Store({
modules:{
    userStore,
    plugins: [vuexLocalStorage.plugin]
},

strict:debug
})

userStore.js

const state = {
    authUser:null,
    roles:null
}
const mutations  = {
    SET_AUTH_USER(state,userObj){
        state.authUser = userObj
    },
    SET_USER_ROLE(state,userRole){
        state.roles = userRole      
    }
}
const actions = {
    setUserObject :({commit},userObj) => {
        commit('SET_AUTH_USER',userObj)
    },
    setUserRoles :({commit},userRole) => {
        commit('SET_USER_ROLE',userRole)
    }
}
export default {
    state, mutations, actions
}

Sidebar.vue

created(){
    this.getRoles();
},
methods: {
    getRoles(){
        var _this = this
        _this.roles_data = response.data
        _this.$store.dispatch('setUserRoles',_this.roles_data)
        _this.fetch_roles()
    }
    fetch_roles(){
        console.log(this.$store.state.userStore.roles)
        // OUTPUT
        // (3) [{…}, {…}, {…}, __ob__: Observer]

        console.log(this.$store.state.userStore)
        // OUTPUT
        // {__ob__: Observer}
        // authUser: "NqStDm8ol3QGtoh0hzL7yhC3NP3HV0ktYKmYHI8TNiCjG4T4tLlv3pOEWFdA5CEh"
        // roles: Array(3)      
    }
}

Dashboard.vue

created(){
    console.log(this.$store.state.userStore.roles)
    // OUTPUT
    // null

    console.log(this.$store.state.userStore)
    // OUTPUT
    // {__ob__: Observer}
    // authUser: "NqStDm8ol3QGtoh0hzL7yhC3NP3HV0ktYKmYHI8TNiCjG4T4tLlv3pOEWFdA5CEh"
    // roles: Array(3)
}

hi I am working on vuex to store user roles access. I am storing two variable in store 1) authUser 2) roles. authUser store user token and roles store user roles array. When i fetch role from api, i dispatch roles to _this.$store.dispatch('setUserRoles',_this.roles_data). When i console in sidebar i get output like this

console.log(this.$store.state.userStore.roles)
(3) [{…}, {…}, {…}, __ob__: Observer]

console.log(this.$store.state.userStore)
{__ob__: Observer}
authUser: "NqStDm8ol3QGtoh0hzL7yhC3NP3HV0ktYKmYHI8TNiCjG4T4tLlv3pOEWFdA5CEh"
roles: Array(3)

But when i console same thing in dashboard in created function it return roles null

console.log(this.$store.state.userStore.roles)
null

console.log(this.$store.state.userStore)
{__ob__: Observer}
authUser: "NqStDm8ol3QGtoh0hzL7yhC3NP3HV0ktYKmYHI8TNiCjG4T4tLlv3pOEWFdA5CEh"
roles: Array(3)

Am i missing something ?? or its a bug

26 Oct
1 month ago
25 Oct
1 month ago

Kaustubh started a new conversation Merging Nested Array Boolean Values

I have an array Output something like this and i want to merge them by page_id

    Object
        data: Array(2)
        0: Array(25)
            0: {page_id: 1, view: true, edit: true, update: true, delete: true}
            1: {page_id: 2, view: true, edit: false, update: false, delete: true}
            2: {page_id: 3, view: true, edit: false, update: false, delete: false}
            length: 3
            __proto__: Array(0)
        1: Array(25)
            0: {page_id: 1, view: false, edit: false, update: false, delete: true}
            1: {page_id: 2, view: false, edit: false, update: false, delete: true}
            2: {page_id: 3, view: false, edit: false, update: false, delete: false}
            length: 3
            __proto__: Array(0)
        .
        .
        .
        .
        
        length: 2

I need Output something like this

    result[0] => {
        0: {page_id: 1, view: true, edit: true, update: true, delete: true}
        1: {page_id: 2, view: true, edit: false, update: false, delete: true}
        2: {page_id: 3, view: true, edit: false, update: false, delete: false}          
    }

Thanks in advance

24 Oct
1 month ago

Kaustubh started a new conversation Merge Multiple Array Values

I have 1 and more than 1 array and i have to merge them.

arr[0] => { view:true, edit:true, delete:false } arr[1] => { view:false, edit:true, delete:false } arr[2] => { view:true, edit:true, delete:true }

I need output like this

result = { view:true, edit:true, delete:true }

if any one of object have true value it should replace it to true from false

Thanks in advance

28 Aug
3 months ago

Kaustubh started a new conversation Dropdown Model-list-select :list Not Working In Popup Modal

Hi

i used dropdown input in popup model and assigned array value in :list="conopt" when i select the option i get the country name, but i was expecting for array which has id, name, sortname.

When i put that dropdown outside popup model i got my expected result. But problem is that i want that result in popup model.

// USING Dropdown List in Popup Modal (Not Working as Expected)

<div>
<b-modal title="Add Supplier" hide-footer size="lg" v-model="largeModal" @ok="largeModal = false" style="width: 140%; margin: auto;">
    <model-list-select :list="conopt" class="form-control"
        option-value="country_name"
        option-text="country_name"
        v-model="con"
        @input="state">
    </model-list-select >
</b-modal>
</div>

<script type="text/javascript">
    state(conopt){
      console.log(conopt) // Result India
    }
</script>

// USING Dropdown List without Popup Modal (Working as Expected) <model-list-select :list="conopt" class="form-control" option-value="country_name" option-text="country_name" v-model="con" @input="state"> </model-list-select >

<script type="text/javascript">
    state(conopt){
      console.log(conopt)
        /*
        GETTING EXPECTED RESULT
        {__ob__: Observer}
            country_name:"India"
            id:"45"
            phonecode:"91"
            sortname:"IN"
        */
    }
</script>
06 Aug
4 months ago

Kaustubh started a new conversation Laravel SSL Not Working Properly

I have windows server and have domain of godaddy. I took SSL from godaddy and apply on my server. My domain gets secure by SSL but problem come when, i redirect from https://www.example.com and logged in it shows dashboard but when i change url to https://example.com it redirect me to login page.

Here is my VHOST file

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "C:/mcpluat/xampp/htdocs/project/public"
    ServerName www.example.com
    ServerAlias example.com
    
    RewriteEngine on
    
    RewriteCond %{SERVER_PORT} 80  
    RewriteRule ^(.*)$ https://www.example.com/ [R,L]

    <Directory "C:/mcpluat/xampp/htdocs/project/public">
      Options Indexes FollowSymLinks Includes ExecCGI
       AllowOverride All
       Require all granted
    </Directory>
</VirtualHost>

.HTACCESS file

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Everything is working perfectly but why it is treating www.example.com and example.com a different domain

Thanks in advance

12 Jul
4 months ago

Kaustubh started a new conversation Undefined Index Driver

Hi, I have two different database and i connect to another database to get the data. It works fine but when i continuously press refresh it throws Undefined Index Driver. below is my code

CONNECTION TO ANOTHER DATABASE

  // Disconnect old connection and connect to other database
  $dm = app("Illuminate\Database\DatabaseManager");
  $dm->disconnect();
  $model = Config::set("database.connections.pgsql", [
      'driver'    => 'pgsql',
      'host'      => '127.0.0.1',
      'port'      => '5432',
      'database'  => 'mwayhire_jobseeker',
      'username'  => 'postgres',
      'password'  => 'root',
      'charset'   => 'utf8',
  ]);
  DB::setDefaultConnection('pgsql');
  DB::reconnect($model);
  //End

RE CONNECTION TO CURRENT DATABASE

    // Disconnect old connection and connect to original database
    $model = Config::set("database.connections.".env('DB_CONNECTION'), [
        'driver'    => env('DB_CONNECTION'),
        'host'      => env('DB_HOST'),
        'port'      => env('DB_PORT'),
        'database'  => env('DB_DATABASE'),
        'username'  => env('DB_USERNAME'),
        'password'  => env('DB_PASSWORD'),
        'charset'   => 'utf8',
    ]);
    DB::setDefaultConnection(env('DB_CONNECTION'));
    DB::reconnect($model);
    //End

The reason behind the error is, i called credential from env file and on refresh it sometime dosent get value from env. I dont want to use hardcore values to reconnect to current database. Is there any solution for this

21 May
6 months ago

Kaustubh left a reply on Copy Files From URL To Server Public Folder

thanks @lostdreamer_nl

i got the solution file_put_contents(public_path('datafiles\APPL').'/'.$resume,fopen(REQUEST('cand_resume_url'), 'r'));

Kaustubh started a new conversation Copy Files From URL To Server Public Folder

Hi I have two project in which one project contains files and another one dont have file. I want to copy the file from one server to another server.

Server 1 URL = http://localhost/jobseeker/public/datafiles/APPL/JOBSEEKER_trOoH.pdf

Server 2 URL = http://localhost/recruiter/public/

I want to copy server1 file in server2 public folder

    $file1 = REQUEST('cand_resume_url');
    $file2 = public_path('datafiles\APPL');
    File::move($file1, $file2);

I used Copy, Move but it throwing error

The file "http://localhost/mwayhire_jobseeker/public/datafiles/APPL/JOBSEEKER_trOoH.pdf" does not exist

11 May
7 months ago
10 May
7 months ago

Kaustubh started a new conversation Queue Sending All Mails To Last Recipient

Hi There, I am currently facing an issue in queue mails. I made a queue table and it works perfectly when i send email to one person, but the issue comes when i fetch all records from table and foreach each of them and send mail to each recipient, It sends all the emails to the last recipient of the record. When i send email without queue it works perfectly.

for eg. i have two records in table 1st has [email protected] and another one has [email protected], when i use queue it send both emails to [email protected] and not to [email protected]

            // Daily Reports to BUSINESS HEAD
            $business = Business::where('b_daily',1)->select('business_name','b_email_id')->get();
            foreach ($business as $bus){
                dispatch(new SendEmailReports($bus->b_email_id));
            }

Please let me know if i am missing something.

20 Mar
8 months ago

Kaustubh left a reply on Fetch Auth::user()->name From Database

actuall i am appending the response on ajax success

$("#chat-section ul").append('<li><div class="left-chat"><img src="https://images.g2crowd.com/uploads/product/image/large_detail/large_detail_1508920769/chatbotsbuilder.png"><p>'+data+'</p></div></li>');

The 'data' contain this output 'your name is {!! auth::user()->name !!}'
19 Mar
8 months ago

Kaustubh started a new conversation Fetch Auth::user()->name From Database

Hi I have query table

id query output 1 What is my name your name is {!! auth::user()->name !!}

when i fetch data in blade i get this output your name is {!! auth::user()->name !!}

but i want your name is "USER NAME"

16 Feb
9 months ago

Kaustubh left a reply on Eloquent Relationship Not Working

Quantity presents in ShopInventory Table

15 Feb
9 months ago

Kaustubh left a reply on Eloquent Relationship Not Working

@arthurvillar i followed your method but Still not working

Kaustubh left a reply on Eloquent Relationship Not Working

@Dexterr I think that will not affect. I dont know why its not Joining

Kaustubh left a reply on Eloquent Relationship Not Working

I just updated

Kaustubh started a new conversation Eloquent Relationship Not Working

Hi There I just stucked on Eloquent Relationship. The Two table are not joining. I am getting this error SQLSTATE[42703]: Undefined column: 7 ERROR: column "quantity" does not exist LINE 1: select "quantity" from "mi_cmp_product" where "mi_cmp_produc... ^ (SQL: select "quantity" from "mi_cmp_product" where "mi_cmp_product"."id" is null and "product_id" = ABC3408804)

There are Two Table 1) Company Product & 2) Shop Inventory

  1. Company Product ========================================================== id product_id(PK) product_name product_desc ========================================================== 1 | PRO1 | ABC | ABC 2 | PRO2 | ABC | ABC 3 | PRO3 | ABC | ABC
  1. Shop Inventory

========================================================== id shopid(PK) product_id(FK) Quantity ========================================================== 1 | SHP1 | PRO1 | 8 2 | SHP1 | PRO2 | 5 3 | SHP2 | PRO1 | 2

Company Product Model

12 Jan
10 months ago

Kaustubh left a reply on Is My Laravel Project Has Been Hacked Or Bug

Just now i found that Every files in xampp has been affected

Kaustubh started a new conversation Is My Laravel Project Has Been Hacked Or Bug

I had deployed my laravel project on Amazon Server and i recently found some extra php line of code auto generated in every files of laravel framework. I don't know is it virus or bug or it has been hacked. I have attach a sample screenshot below of config/view.php file

https://i.stack.imgur.com/jlG8h.jpg

03 Jan
11 months ago
02 Jan
11 months ago

Kaustubh started a new conversation How Sync Database From Remote To Server Database

Hi I am creating an application in which every user has application install at their remote system. When the user gets connected to database his local system database will be sync to main server database.

I dont know how to sync database from local to server.

15 Nov
1 year ago

Kaustubh started a new conversation Select Table And Count Rows From Another Table Whose Seen Is 0

Here i want to fetch post table and i want to count records on postConversation table where post.id = postConversation.PostId where seen = 0. but in below query i get the record of all whose seen is 0 & 1, but in my case i want to fetch those row whose seen is 0

Post Table (post) id | title | text | hasImage | img_path | mentorid | menteeid | status 1 Title1 ABC 0 1113.png 12 11 1

Post Conversation Table (postConversation) id | PostId | conv | sender | receiver | seen | sen_del | rec_del 1 1 ABC 11 12 1 0 0 2 1 XYZ 12 11 1 0 0 3 1 ZCX 11 12 0 0 0 4 1 PAQ 11 12 0 0 0

$discussPosts = DB::table('post')->leftJoin('postConversation', 'post.id', '=', 'postConversation.Did') ->select('post.*', DB::raw('count(postConversation.Did) as postConversationCount')) ->groupBy('post.id') ->where('mentorid',Auth::user()->id) ->where('menteeid',$userid) ->get(); dd($discussion) //Result

Collection {#478 ▼ #items: array:4 [▼ 0 => {#476 ▼ +"id": 1 +"title": "Title1" +"text": "ABC" +"hasImage": "1" +"img_path": "1113.png" +"mentorid": "12" +"menteeid": "11" +"status": "1" +"created_at": "2017-11-16 11:16:13" +"updated_at": "2017-11-16 11:16:13" +"postConversationCount": 4

13 Nov
1 year ago

Kaustubh left a reply on Dynamic Routes

route can be anything like register, home etc.

Kaustubh left a reply on Dynamic Routes

@RamjithAp i want to redirect to any other defined route if not found in table. such as if i write http://localhost/community/public/login it first check in community controller and if not found the default login route will be called

Kaustubh started a new conversation Generate-routes-dynamically

Route

Route::get('{communityName}', '[email protected]')->name('test');

Controller

public function test($CommunityName)
{
    $community = Community::where('communityName',$CommunityName)->get();
    if(!$community)
    {
        return redirect()->route($community);
    }

    return view('layouts.Community',compact('community'));
}

Here i want to redirect to community page if it is present in table and if that name not present in table then it should redirect to specific route

for eg. // Should redirect to community page http://localhost/community/public/DUMMYCOMMUNITY

// Should redirect to login page http://localhost/community/public/login

But this process is going in an infinite loop. is there any best way to achive this

02 Nov
1 year ago
01 Nov
1 year ago

Kaustubh left a reply on CSRF Token Mismatch

HTML FORM

                <form role="form" method="POST" action="{{ route('CommunityRegister') }}" id="form1">
                <input type="hidden" value="register" name="tab" />
                <input type="hidden" name="communityName" id="communityName" value="{{ $name }}">
                <input type="hidden" name="communityToken" id="communityToken" value="{{ $token }}">
                {{ csrf_field() }}

                    <div class="form-group">
                        <label for="email">Community Name:</label>
                        <input id="communityName1" type="text" class="form-control" name="communityName1" value="{{ $name }}" autocomplete="off" required disabled="">
                    </div>

                    <div class="form-group">
                        <label for="email">Community Token:</label>
                        <input id="communityToken1" type="text" class="form-control" name="communityToken1" value="{{ $token }}" autocomplete="off" required disabled="">
                    </div>

                    <div class="form-group">
                        <label for="email">First Name:</label>
                        <input id="fname" type="text" class="form-control" name="fname" value="{{ old('fname') }}" autocomplete="off" required>
                        @if ($errors->has('fname'))
                            <span>
                              <small style="color: #e05d6e;">{{ $errors->first('name') }}</small>
                            </span>
                        @endif
                    </div>

                    <div class="form-group">
                        <label for="email">Last Name:</label>
                        <input type="text" name="lname" id="lname" class="form-control" value="{{ old('lname') }}" autocomplete="off" required>
                        @if ($errors->has('lname'))
                            <span>
                              <small style="color: #e05d6e;">{{ $errors->first('lname') }}</small>
                            </span>
                        @endif
                    </div>

                    <div class="form-group">
                        <label for="email"> Mobile or Email <small style="color: #e05d6e;">(Email compulsory if not from community link)</small>:</label></br>
                        <input id="mobile" type="text" class="form-control" name="mobile" value="{{ old('mobile') }}" autocomplete="off" style="width: 100% !important">
                        @if ($errors->has('mobile'))
                            <span>
                              <small style="color: #e05d6e;">{{ $errors->first('mobile') }}</small>
                            </span>
                        @endif
                    </div>

                    <div class="form-group">
                        <label for="password">Password: </label>
                        <input id="pass" type="password" name="pass" class="form-control" autocomplete="off" required>
                        @if ($errors->has('pass'))
                            <span>
                              <small style="color: #e05d6e;">{{ $errors->first('pass') }}</small>
                            </span>
                        @endif
                    </div>
                    
                    <input type="submit" name="signup" value="Sign Up & Login" class="btn btn-primary btn-block active" aria-pressed="true">

                </form>

CONTROLLER

public function CommunityRegister(Request $req)
{
    $input = $req->all();
    $mobile = REQUEST('mobile');
    if(is_numeric($mobile)){
        $has_mobile = 1;
        $validator = Validator::make($input, [
            'fname' => 'required|string|max:20',
            'lname' => 'required|string|max:20',
            'mobile' => 'required|numeric|unique:users',
            'pass' => 'required|string|min:6',
        ]);
    }else{
        $has_mobile = 0;
        $validator = Validator::make($input, [
            'fname' => 'required|string|max:20',
            'lname' => 'required|string|max:20',
            'mobile' => 'required|string|email|max:50|unique:users',
            'pass' => 'required|string|min:6',
        ]);
    }

    if($validator->passes())
    {
        $fname = REQUEST('fname');
        $lname = REQUEST('lname');
        $mobile = REQUEST('mobile');
        $password = bcrypt(REQUEST('pass'));
        $emailtoken = str_random(25);

        $ids = DB::table('users')->orderBy('id','desc')->pluck('id')->first();
        $count = $ids + 1;
        $username = strtolower($fname.$count);
        $name = $fname.' '.$lname;

        $data = array(
            'name' => $name,
            'fname' => $fname,
            'lname' => $lname,
            'username' => $username,
            'mobile' => $mobile,
            'password' => $password,
            'emailtoken' => $emailtoken,
            'has_mobile'   => $has_mobile,
            'phone_verified' => TRUE,
        );
        DB::table('users')->insert($data);
        $userid = DB::table('users')->where('mobile',$mobile)->pluck('id')->first();
        $cid = DB::table('community')->where('name',REQUEST('communityName'))->where('token',REQUEST('communityToken'))->pluck('id')->first();

        $endDate = DB::table('community')->where('id',$cid)->pluck('endDate')->first();
        if(date('Y-m-d') <= $endDate)
        {
            $status = 1;
        }
        else{
            $status = 0;                
        }

        $communitydata = array(
            'Cid'       =>  $cid,
            'Uid'       =>  $userid,
            'admin'     =>  0,
            'status'    =>  $status,
        );

        DB::table('community_user')->insert($communitydata);

        $credentials = array(
            'mobile' => REQUEST('mobile'),
            'password' => REQUEST('pass'),
        );

        if (Auth::attempt($credentials)) {
            return redirect()->route('start');
        }
        else{
            return redirect()->back()->with('status','Something Went Wrong');
        }
    }

    return redirect()->back()->withErrors($validator)->withInput();
}

Kaustubh left a reply on CSRF Token Mismatch

Within 10 min. It throws error even when i am not logged in.

Kaustubh started a new conversation CSRF Token Mismatch

I am facing problem on a form submission. When i open a form and submit it after some time it throws token mismatch exception.

05 Sep
1 year ago
04 Sep
1 year ago

Kaustubh left a reply on How To Read Barcode From Device

@ModestasV i didnt get it, I actually want to know how does it happen that when I scan the barcode using barcode scanner, how it will automatically put in my html textbox

Kaustubh started a new conversation How To Read Barcode From Device

Hi Guys

I generated barcode successfully, but now i want to read barcode from the barcode reader device (i dont have right now) but i want to know that is there any package which, fetch the data from that barcode device.

From reading barcode i will be able to display full details on user system.

Thanks in advance

29 Aug
1 year ago

Kaustubh left a reply on How To Get Table And Text Value Of Phpword

@bashy is there any package which convert doc, docx or any other file to PDF

21 Aug
1 year ago

Kaustubh started a new conversation How To Use Pg_unescape_bytea

I successfully stored file in database (bytea datatype), but when i try to retrive my file it throws error

Method Illuminate\Support\Collection::__toString() must return a string value

My controller

public function index()
{
    $img = DB::table('images')->pluck('file');
    $decode = pg_unescape_bytea($img);
    dd($decode);
    return view('home',compact('decode'));
}

// To store file in database

public function save(Request $req)
{
    $resume = Input::file('file');
    $extenstion = file_get_contents($resume);
    $file = pg_escape_bytea($extenstion);
    $data = array('file' => $file); 
    DB::table('images')->insert($data);
    return redirect()->back();
}
16 Aug
1 year ago

Kaustubh started a new conversation How To Pass Variable In Validation Rule

Hi guys,

I want to validate text field if Commission amount is less than 4.5% on Salary

<input type="text" id="salary" name="salary">
<input type="text" id="commission" name="commission" placeholder="Amt should be >= 4.5% on salary">

public function hrCJPsave(Request $req)
{  
     $salary => REQUEST('salary');
     $commission = $salary*4.5/100;

    $input = $req->all();
    $validator = Validator::make($input, [
        'salary'            =>  'required|max:2',
        'commission'        =>  'required|min:$commission'            
    ]);
}

How can i pass variable in validator

15 Aug
1 year ago

Kaustubh started a new conversation Old Value In Select Option

Hi,

I have a form in which there is a select option for Gender, what i want to achive is if my validator fails then its get redirect back with old inputs. but i dont know how to populate my select option with old value.

<select id="gender" name="gender">
    <option value="male">Male</option>
    <option value="female">Female</option>
</select>

I have another question. I have user table in which user has role. When admin update user record his role dropdown should contain all roles but the selected role should be his role which is in his record

Role Dropdown -  HR Manager   ----> selected ..as stored in database
                              Admin
                              Superadmin
09 Aug
1 year ago