shuvobhai

Web developer at website development

Member Since 1 Year Ago

Chittagong

Experience Points
1,380
Total
Experience

3,620 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

  • Community Pillar

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

Level 1
1,380 XP
Nov
28
1 month ago
Activity icon

Started a new Conversation How To Add Laravel Echo Server And Socket Io In Jquery

<script type="module">

        import Echo from '../../../node_modules/laravel-echo';
        window.io = require('socket.io-client');

        window.Echo = new Echo({
            broadcaster: 'socket.io',
            host: window.location.hostname + ':6001',

        });
        window.Echo.channel('notify').listen('Notify',(data) => {
            alert('notify');
        });
    </script>
home:965 GET http://127.0.0.1:8000/node_modules/laravel-echo net::ERR_ABORTED 404 (Not Found)
Nov
23
2 months ago
Activity icon

Replied to Laravel-echo-server Error

i try route list now.The /broadcasting/auth route is missing.how can i fix this

Activity icon

Started a new Conversation Laravel-echo-server Error

⚠ [12:16:12 PM] - Dtrrc_K-8NCSXb_MAAAA could not be authenticated to presence-chat-room-7

{
    "message": "",
    "exception": "Symfony\Component\HttpKernel\Exception\NotFoundHttpException",
    "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\RouteCollection.php",
    "line": 179,
    "trace": [
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
            "line": 634,
            "function": "match",
            "class": "Illuminate\Routing\RouteCollection",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
            "line": 623,
            "function": "findRoute",
            "class": "Illuminate\Routing\Router",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
            "line": 612,
            "function": "dispatchToRoute",
            "class": "Illuminate\Routing\Router",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
            "line": 176,
            "function": "dispatch",
            "class": "Illuminate\Routing\Router",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 30,
            "function": "Illuminate\Foundation\Http\{closure}",
            "class": "Illuminate\Foundation\Http\Kernel",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\fideloper\proxy\src\TrustProxies.php",
            "line": 57,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 163,
            "function": "handle",
            "class": "Fideloper\Proxy\TrustProxies",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php",
            "line": 21,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 163,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php",
            "line": 21,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 163,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php",
            "line": 27,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 163,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\ValidatePostSize",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php",
            "line": 62,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 163,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 104,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
            "line": 151,
            "function": "then",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
            "line": 116,
            "function": "sendRequestThroughRouter",
            "class": "Illuminate\Foundation\Http\Kernel",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\public\index.php",
            "line": 55,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Kernel",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\server.php",
            "line": 21,
            "function": "require_once"
        }
    ]
}
Client can not be authenticated, got HTTP status 404
[12:16:18 PM] - Dtrrc_K-8NCSXb_MAAAA left channel: test (transport close)
[12:16:19 PM] - Preparing authentication request to: http://localhost:8000
[12:16:19 PM] - Sending auth request to: http://localhost:8000/broadcasting/auth

[12:16:19 PM] - _8kiXSUKTR4RYOTaAAAC joined channel: test
⚠ [12:16:20 PM] - _8kiXSUKTR4RYOTaAAAC could not be authenticated to presence-chat-room-7

{
    "message": "",
    "exception": "Symfony\Component\HttpKernel\Exception\NotFoundHttpException",
    "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\RouteCollection.php",
    "line": 179,
    "trace": [
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
            "line": 634,
            "function": "match",
            "class": "Illuminate\Routing\RouteCollection",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
            "line": 623,
            "function": "findRoute",
            "class": "Illuminate\Routing\Router",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
            "line": 612,
            "function": "dispatchToRoute",
            "class": "Illuminate\Routing\Router",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
            "line": 176,
            "function": "dispatch",
            "class": "Illuminate\Routing\Router",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 30,
            "function": "Illuminate\Foundation\Http\{closure}",
            "class": "Illuminate\Foundation\Http\Kernel",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\fideloper\proxy\src\TrustProxies.php",
            "line": 57,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 163,
            "function": "handle",
            "class": "Fideloper\Proxy\TrustProxies",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php",
            "line": 21,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 163,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php",
            "line": 21,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 163,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php",
            "line": 27,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 163,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\ValidatePostSize",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php",
            "line": 62,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 163,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
            "line": 53,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 104,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
            "line": 151,
            "function": "then",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
            "line": 116,
            "function": "sendRequestThroughRouter",
            "class": "Illuminate\Foundation\Http\Kernel",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\public\index.php",
            "line": 55,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Kernel",
            "type": "->"
        },
        {
            "file": "C:\laragon\www\shongjogyou\server.php",
            "line": 21,
            "function": "require_once"
        }
    ]
}
Client can not be authenticated, got HTTP status 404




Nov
12
2 months ago
Activity icon

Replied to Laravel Echo Server Error In Production

its wroking good on local server.but showing error in live server

Activity icon

Started a new Conversation Laravel Echo Server Error In Production



L A R A V E L  E C H O  S E R V E R

version 1.6.2

Starting server...

✔  Running at localhost on port 6001
✔  Listening for http events...
✔  Listening for redis events...

Server ready!

(node:3348905) UnhandledPromiseRejectionWarning: TypeError: Cannot convert undefined or null to object
    at /usr/lib/node_modules/laravel-echo-server/dist/channels/presence-channel.js:78:21
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3348905) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3348905) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Nov
09
2 months ago
Activity icon

Started a new Conversation Uncaught ReferenceError: C Is Not Defined In App.js

i don't know why this error is showing . i didn't change anything on my code ,this error suddenly come up after i run npm run watch.please anyone help

Nov
04
2 months ago
Activity icon

Started a new Conversation Laravel Phpjunior Package Module Not Found Error

This code in resource/js/app.js folder and those component are in resource/assets/js/component/laravel-video-chat.


 import VueChatScroll from 'vue-chat-scroll';
 import VueTimeago from 'vue-timeago';
 
 Vue.use(VueChatScroll);
 Vue.component('chat-room' , require('./components/laravel-video-chat/ChatRoom.vue'));
 Vue.component('group-chat-room', require('./components/laravel-video-chat/GroupChatRoom.vue'));
 Vue.component('video-section' , require('./components/laravel-video-chat/VideoSection.vue'));
 Vue.component('file-preview' , require('./components/laravel-video-chat/FilePreview.vue'));
 
 Vue.use(VueTimeago, {
     name: 'timeago', // component name, `timeago` by default
     locale: 'en-US',
     locales: {
         'en-US': require('vue-timeago/locales/en-US.json')
     }
 })

i change the require path to require('./assets/js/components/laravel-video-chat/ChatRoom.vue') but same error is showing model not found. Any solution guys

Oct
27
2 months ago
Activity icon

Started a new Conversation Vue V-select Array Of Object Not Showing In The Select Option

laravel project

on app.js ----

/**
 * First we will load all of this project's JavaScript dependencies which
 * includes Vue and other libraries. It is a great starting point when
 * building robust, powerful web applications using Vue and Laravel.
 */

require('./bootstrap');

window.Vue = require('vue');

import VueRouter from 'vue-router'
import Cat from './components/dashboard/category/Category.vue';
import Sub from './components/dashboard/sub-category/sub-category.vue'; 
import Dash from './components/dashboard/Dashboard.vue';
import VueToast from 'vue-toast-notification';
import Vuetify from 'vuetify';
import 'vuetify/dist/vuetify.min.css';
import VModal from 'vue-js-modal';
// import Vue from 'vue';
import vSelect from 'vue-select';
import 'vue-select/dist/vue-select.css';

// Import one of available themes
import 'vue-toast-notification/dist/theme-default.css';
import { Form, HasError, AlertError } from 'vform';

window.Form = Form;


 
// import {routers} from './routers';
Vue.use(Vuetify)
Vue.use(VueToast); 
Vue.use(VueRouter);
Vue.use(VModal);
// Vue.use(vSelect)
Vue.component('v-select', vSelect)
const routes = [
    // { path: '/foo', component: require('./components/Category.vue') },
    { path: '', component: Dash },
    { path: '/category', component: Cat },
    { path: '/sub-category', component: Sub },
  ]
const router = new VueRouter({
    routes
})

const app = new Vue({
    el: '#app',
    router,
    vuetify: new Vuetify()
});

On component ------


 <v-select  v-model="select"  :items="categories" label="Select" item-text="name"  item-value="id" return-object> </v-select>



export default {
  data(){
    return {
        form: new Form({
            name:'',
            imgUrl:'',
            remember: false
      }),
      categories:[],
      select: 'Select',
    }
  },

  mounted(){
   this.getCategories() 
  },
  methods:{
    getCategories(){
      axios.get('sub-category')
      .then(res => (
        res.data.forEach((value, index) => {
            this.categories.push(value);
        })
     ));
    }
  }
}

Sep
20
4 months ago
Activity icon

Replied to How To Update Existing Data And Create If No Data Is Exist In Pivot Table

i need to create the new product if that product is not exist in the pivot table..May be updateExistingPivot cannot do that

Activity icon

Started a new Conversation How To Update Existing Data And Create If No Data Is Exist In Pivot Table

i have a product_sell pivot table . i store data in pivot table . Now i want to edit the table that i store . what i want is i want to update existing product and create new product on that table .

Sep
17
4 months ago
Activity icon

Replied to How To Update And Create Multiple Product In Sell Table With UpdateOrCreate Method

This one is Product Table

 Schema::create('products', function (Blueprint $table) {
            $table->id();
            $table->integer('supplier_product_id');
            $table->string('name');
            $table->string('model_name');
            $table->unsignedBigInteger('category_id');
            $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
            $table->integer('ppc');
            $table->integer('supplier_price');
            $table->integer('sell_price');
            $table->string('product_img');
            $table->integer('cartoon');
            $table->integer('qty');
            $table->integer('rate');
            $table->integer('total');

            $table->timestamps();

This one is Sell table

 Schema::create('sells', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('customer_id');
            $table->string('date');
            $table->text('details');
            $table->string('payment_type');
            $table->integer('grand_total');
            $table->integer('due')->nullable();
            $table->integer('paid');
            $table->timestamps();
        });

This one is Pivot table

 Schema::create('product_sell', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('product_id');
            $table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
            $table->unsignedBigInteger('sell_id');
            $table->foreign('sell_id')->references('id')->on('sells')->onDelete('cascade');
            $table->integer('cartoon');
            $table->integer('qty');
            $table->integer('rate');
            $table->integer('total');
            $table->timestamps();
        });

Now what i need is when admin sell a product and mistake in the sell table and he go back to edit that table and add another product to that table . That is why i used updateOrCreate method because i want if product exists then update it if not then create it in the pivot table

Activity icon

Replied to How To Update And Create Multiple Product In Sell Table With UpdateOrCreate Method

i only want to update my pivot table so why error is showing product table supplier_product_id column doesn't have a default value

Activity icon

Replied to How To Update And Create Multiple Product In Sell Table With UpdateOrCreate Method

no sir , In pivot table i have product_id but i have supplier_product_id in my product table .

Activity icon

Replied to How To Update And Create Multiple Product In Sell Table With UpdateOrCreate Method

i try your code and its return this error

    $sell->Products()->updateOrCreate(['product_id' => $request->product_id[$i]],
                [
                    'cartoon' => $request->cartoon[$i],
                    'qty' => $request->qty[$i],
                    'rate' => $request->rate[$i],
                    'total' => $request->total[$i],
                ]
            );

SQLSTATE[HY000]: General error: 1364 Field 'supplier_product_id' doesn't have a default value (SQL: insert into `products` (`cartoon`, `qty`, `rate`, `total`, `updated_at`, `created_at`) values (3, 36, 1250, 45000, 2020-09-17 06:18:15, 2020-09-17 06:18:15))
Sep
10
4 months ago
Activity icon

Started a new Conversation How To Update And Create Multiple Product In Sell Table With UpdateOrCreate Method

how to update and Create mutiple array of product data in laravel with updateOrCreate

This is my code and is not working correctly

$sell = Sell::find($id);

    for ($i=0; $i < count($request->product_id); $i++) { 
        $sell->Products()->updateOrCreate($request->product_id[$i],
            [
                'cartoon' => $request->cartoon[$i],
                'qty' => $request->qty[$i],
                'rate' => $request->rate[$i],
                'total' => $request->total[$i],
            ]
        );

        $product =  Product::where('id', $request->product_id[$i])->first();
        $product->cartoon = $request->av_cartoon[$i];

        $qty =   ($request->av_cartoon  +  $request->cartoon) * $product->ppc; //math of total quantity
        $product->qty = $qty  - $request->qty[$id]; //then minus the existing qty from product qty
      
        $product->save();
    }
Activity icon

Replied to UpdateOrCreatein Laravel

i add two back tick before and after and its show like that.its just array of mupltiple product data like -- you will understand if you look that request wisely

Activity icon

Replied to UpdateOrCreatein Laravel

+request: Symfony\Component\HttpFoundation\ParameterBag {#44 ▼ #parameters: array:16 [▼ "_token" => "NbuqTSyqCZs25h8MjNZaI6IZ72vo1imNbWR1H01" "_method" => "PATCH" "customer" => "1" "date" => "2020-09-08" "details" => "fasdfas" "payment_type" => "cash" "av_cartoon" => array:2 [▶] "cartoon" => array:2 [▶] "ppc" => array:2 [▶] "qty" => array:2 [▶] "rate" => array:2 [▶] "total" => array:2 [▶] "product_id" => array:1 [▶] "grand_total" => "164992" "paid" => "164992" "due" => "0" ] }

Activity icon

Replied to UpdateOrCreatein Laravel

i have a sell data and now i want to update that existing sell data with existing product and add a new product in that sell data

Activity icon

Started a new Conversation UpdateOrCreatein Laravel

how to update and Create mutiple array of product data in laravel with updateOrCreate

This is my code and is not working correctly

$sell = Sell::find($id);

    for ($i=0; $i < count($request->product_id); $i++) { 
        $sell->Products()->updateOrCreate($request->product_id[$i],
            [
                'cartoon' => $request->cartoon[$i],
                'qty' => $request->qty[$i],
                'rate' => $request->rate[$i],
                'total' => $request->total[$i],
            ]
        );

        $product =  Product::where('id', $request->product_id[$i])->first();
        $product->cartoon = $request->av_cartoon[$i];

        $qty =   ($request->av_cartoon  +  $request->cartoon) * $product->ppc; //math of total quantity
        $product->qty = $qty  - $request->qty[$id]; //then minus the existing qty from product qty
      
        $product->save();
    }
Sep
04
4 months ago
Activity icon

Started a new Conversation How Can I Update Previous Data And Besides Insert New Data

how to update a existing data and besides insert a new data in laravel

this is not wroking

$sell->Products()->sync($request->product_id[$i], [ 'cartoon' => $request->cartoon[$i], 'qty' => $request->qty[$i], 'rate' => $request->rate[$i], 'total' => $request->total[$i], ] );