saurav77

saurav77

Member Since 1 Month Ago

Experience Points
3,870
Total
Experience

1,130 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
5
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.

Level 1
3,870 XP
Oct
21
4 days ago
Activity icon

Replied to How To Manage Large Amount Of Data In Laravel API ?

@rodrigo.pedra thanks a lot for responding Okay, let's say I have only a link to the API route given by the laravel developer. I have a simple page like index.html page to draw a chart and an advanced table and fetch data like

 fetch('http://nextaustami.com.np/api/barChart')

Now My job is to plot a chart from those laravel API data and also keep data like company name, street, district, etc in a select box for filter and send request coming from the filter to the laravel function.Its simple HTML page only data are taken from another project so So what do you suggest? & thank you for responding. I hope you understand the problem

Activity icon

Replied to How To Manage Large Amount Of Data In Laravel API ?

@rodrigo.pedra something like 1 million data maybe. I am using these data for filters like address filter, state filter, location filter, company filter, year filter, etc. so don't know why my page is not responding.it does not respond properly and cannot be clicked any button or neither right button mouse My code line is around like 750 only

Activity icon

Started a new Conversation How To Manage Large Amount Of Data In Laravel API ?

I'm working on a project where I need to send any data through API Route like

Route::get('/allData','[email protected]');
function Controller(){
$data=Data::get();
 return response()->json([
                 'data' => $data,
         ]);
}

There will a lot of data like 10 lakh 20 lakh something. now I am using that API route in another simple External HTML project to show table & chart. I think due to a load of data my page is not responding properly even I can't check to inspect. So is there any way to handle data properly and help to respond to my HTML page properly?

Activity icon

Awarded Best Reply on My Path For CSS And Javascript Is Not Working ?

@coder72

you need to change main/index.html into main/index.blade.php because this work in only blade file so

Activity icon

Replied to My Path For CSS And Javascript Is Not Working ?

@coder72

you need to change main/index.html into main/index.blade.php because this work in only blade file so

Oct
19
6 days ago
Activity icon

Replied to How To Make Users Column Empty From SQL Statement ?

@coder72 Try this one

INSERT INTO `users` (coursable_id,coureable_type)
VALUES ("NULL","NULL");
Oct
14
1 week ago
Activity icon

Replied to Laravel Where Clause To Search In Columns Which Are Not In The Database

Try this ?

$organisations = Organisation::query();

$organisations = $organisations->where($organizations->device_count, '=', 0);
$organisations = $organisations->get();

what will result come ? if i do

$organisations = Organisation::query(); dd($organisations);

Oct
13
1 week ago
Activity icon

Awarded Best Reply on How To Prevent Tab Button Form Button And Jump Another Field ?

Try tabindex="-1" this

<input type="text" name="full name" class="form-control">
<input type="text" name="last_name" class="form-control">
<a href="{{ route('banks.index') }}" class="btn-primary block-tab " tabindex="-1">Go to another Page</a>
<input type="number" name="age">
<button type="submit" >Save</button>
Activity icon

Replied to How To Prevent Tab Button Form Button And Jump Another Field ?

Try tabindex="-1" this

<input type="text" name="full name" class="form-control">
<input type="text" name="last_name" class="form-control">
<a href="{{ route('banks.index') }}" class="btn-primary block-tab " tabindex="-1">Go to another Page</a>
<input type="number" name="age">
<button type="submit" >Save</button>
Oct
12
1 week ago
Activity icon

Replied to How To Set Option Value Null When Something Is Selected

@uksarkar My problem is when I select some option then another select box should hide and its value should be null but in my case When I select to filter by country and select some country option and again when I click to filter by state then the country value should be null

Activity icon

Started a new Conversation How To Set Option Value Null When Something Is Selected

This is my HTML Select box. When I choose Option Filter by Country then FIlter by Country Select box should appear and all of the state and local address select box should hide and when I select to filter by state then state select box should be appear and other should hide

<select id="filter by address">
<option value="none">All</option>
<option value="0">Filter by Country</option>
<option value="1">Filter by State</option>
<option value="2">Filter by Local Address</option>
</select>

<select id="local_address">
	<option>Select By Local Address</option>
</select>

<select id="country">
	<option>Select By Country</option>
</select>
<select id="state">
	<option>Select By State</option>
</select>

This is the Script file and When choose to filter by country then a country select box appears and another select box will hide but other state and local address option value does not become null

 $('#filter by address').change(function () {
        var address=$(this).val();
        
        if(address==1){
            $("#state").css("display","block");
            $("#country").css("display","none");
            $("#local_address").css("display","none");
            $('#local_address').val(null); //I want to  set them null if state is chooses
            $('#country').val(null); //I want to  set them null if state is chooses
        }else if (address==2){
            $("#local_address").css("display","block");
            $("#country").css("display","none");
            $("#state").css("display","none");
            $('#country').val(null);  //I want to  set them null if local_address is chooses
            $('#state"').val(null);  //I want to  set them null if local_address is chooses
        }else if (address==0){
            $("#country").css("display","block");
            $("#state").css("display","none");
            $("#local_address").css("display","none");
            $('#state').val(null);  //I want to  set them null if country  is chooses
            $('#local_address').val(null);  //I want to  set them null if country is chooses
        }else if(address=="none"){
            $("#country").css("display","none");
            $("#local_address").css("display","none");
            $("#state").css("display","none");
            $('#state').val(null);  //I want to  set them null if none is chooses
            $('#local_address').val(null);  //I want to  set them null if none is chooses
            $('#country').val(null);  //I want to  set them null if none is chooses
        }
    })

So my problem is how to set null other select box option ?

Oct
09
2 weeks ago
Activity icon

Awarded Best Reply on How To Use Result In Round Figure ?

@coder77

total_rate=Math.round((total_rate + Number.EPSILON) * 100) / 100;
Activity icon

Replied to How To Use Result In Round Figure ?

@coder77

total_rate=Math.round((total_rate + Number.EPSILON) * 100) / 100;
Activity icon

Replied to How To Use Result In Round Figure ?

Try this
$total_rate=Math.round(total_rate,2)
Oct
07
2 weeks ago
Activity icon

Replied to Laravel 8 And Vue Install Problem

@yougotnet

composer require laravel/ui:^2.4

// Generate basic scaffolding...
php artisan ui bootstrap
php artisan ui vue

// Generate login / registration scaffolding...
php artisan ui bootstrap --auth
php artisan ui vue --auth
Oct
02
3 weeks ago
Activity icon

Replied to How To Sort Two Array Value From Lowest To Highest And Retrive

@michaloravec how to use your method in this my condition ?

<label>
 @foreach($auctions->users as $key => $bi)
   <select name="users" class="form-control">
   <option></option>
    </select>
@endforeach

<input type="text" placeholder="bidder" value="$auctions->bidder[$key] ?? null }}">
Activity icon

Started a new Conversation How To Sort Two Array Value From Lowest To Highest And Retrive

This is my array data from

"users" => array:4 [▼
    0 => "1"
    1 => "2"
    2 => "3"
    3 => "4"
  ]
  "bidder" => array:4 [▼
    0 => "3"
    1 => "6"
    2 => "7"
    3 => "2"
  ]

But in the blade, I want to be retrieved like this

users_id       | bidder
       4       |  2
       1       |   3
       2       |  6
       3       |  7
Oct
01
3 weeks ago
Activity icon

Replied to How To Get GroupBy District From Database Table

@a4ashraf I have edited my question. I hope you understand my problem

Activity icon

Replied to How To Get GroupBy District From Database Table

@a4ashraf

This is my migration file

addresses.table (Migration file)

$table->string('name');
$table->string('district')->nullable();

offices.table (Migration file)

$table->string('office_name');
$table->string('address_id')->nullable();

This is my office model

 public function address()
    {
        return $this->belongsTo('App\Address');
    }

Activity icon

Started a new Conversation How To Get GroupBy District From Database Table

I want to show all addresses though the office.address_id grouping by District. like this office table has address_id 1 Suppose

id | address _id  |      office_name   |  created_at |
1  | 1            |      office name1  | 2020-10-01  |

then then the district of address.id 1 in Kathmandu and give all result of Kathmandu only

id |   name     |district       |
1  |   name1      |Kathmandu    |
2  |   name2       | Kathmandu  |
3  |   name3       |Bhaktapu r  |
4  |   name4       |Kathmandu   |
5  |   name6       | Bhaktapur  |

& give a result like this

id |   name     |district       |
1  |   name1      |Kathmandu    |
2  |   name2       | Kathmandu  |
4  |   name4       |Kathmandu   |

This is my query for getting all Address in the select box

             
               $office=Office::find($id); //

              $q=$request->get_address
               $address=Address::select('id','name', 'district')
                 ->orderBy('name')
                 ->where('id','=','office->address_id')
                 ->groupBy('district')
                 ->get();
Activity icon

Replied to Updating Laravel 6 To Laravel 7

@boyjarv

Update composer.json file to upgrade PHP version from 7.2 to 7.2.5 and laravel/framework to 7.0.* from 6.0

"require": {
        "php": "^7.2.5",
        "fideloper/proxy": "^4.2",
        "fruitcake/laravel-cors": "^1.0",
        "guzzlehttp/guzzle": "^6.3",
        "laravel/framework": "^7.0",
        "laravel/tinker": "^2.0"
    },
    "require-dev": {
        "facade/ignition": "^2.0",
        "fzaninotto/faker": "^1.9.1",
        "mockery/mockery": "^1.3.1",
        "nunomaduro/collision": "^4.1",
        "phpunit/phpunit": "^8.5"
    },

Copy Handler.php from (https://github.com/laravel/laravel) this into your project handler.php

composer require laravel/ui "^2.0"
 composer update

check whether its working or not with

php artisan --version
Sep
30
3 weeks ago
Activity icon

Started a new Conversation How To Append Option In Select2 Jquery ?

I am trying to used Select2 jQuery for the select box but it's not working

In Html, I have defined id as select_bands

         <select id="select_bands" name="band_name">
         </select>

When I do console.log(data.bands). my data is coming in this way

 0: {id: 1, name: "Deep Purple",....}
 1: {id: 2, name: "led zeppelin" …}
 2: {id: 3, name: "Deep Purple" …}

I used for each loop but not working. It is coming empty.. So to append array data in select2 box?

  .fetch('http://127.0.0.1:8000/api/bands')
    .then(response => response.json())
    .then(data => {
        data.bands.forEach(function (band) {
           $("#select_bands").select2({
                  data: {id: band.id, text: band.name}
              });
        }
    });
``
Sep
29
3 weeks ago
Activity icon

Replied to Having Trouble Updating A Record.

@chinaemporer just try this one

use match instead of any

Route::match(['get','post'],'/editprofile/{profile}', '[email protected]');

use route in action //Blade

<form action="{{ route('editprofile',$user->id) }}" method="POST" enctype="multipart/form-data"> 
@csrf
</form>

//Controller

public function editProfile(Request $request,$id){
if($request->isMethod('post')){
     // just do dd($request->all());
     $profile=User::find($id);
       $profile->name=$request->name;
	$profile->update();
}
$user=User::find($id);
return view('users.edit',compact('user'))
}
Activity icon

Replied to How Can I Undo Migration Or Delete All Tables With Php Artisan?

@cola

You can also use migrate:fresh in newer Laravel versions or you can use

Route::get('/delete-table', function () {
    return Artisan::call('migrate:reset', ['--force' => true]);
});
Activity icon

Started a new Conversation How To Foreach Loop In Dynamic Field ?

This is my database table

id |product_id|order_name |   SKU            | quantity  | order_date
 
1  |    2     |   Bk45KK  | ["BH23","BH24"]  | ["2","3"]    | ["2020-04-03","2020-04-06"]

In Controller

$order=Order::find($id);

In the edit. blade.php file, It is a dynamic field I can increment and decrement the field here. But in my database, there is data like above but only SKU values are getting others are getting empty even if there is data.how should I solve this?

<input type="hidden" name="product_id" value="{{$order->product_id}}">
<input type="text" name="order_name" value="{{$order->order_name}}">
<table>
@foreach(json_decode($order->sku) as $key => $value)
<tr>
    <td>
       <input type="text" name="sku[]" value="{{ json_decode($order->sku)[$key] ?? null }}">
    </td>
     <td>
      <input type="text" name="quantity[]"  value="{{ $order->quantity[$key] ?? null }}"></td>
     <td>
     <input type="text" name="order_date[]" value="{{ $order->order_date[$key] ?? null }}">
</td>
<td> +| -</td> //Increment/Decrement Field
</tr>
@endforeach

I am getting the only value of SKU other is null. What is wrong with this code?

Activity icon

Started a new Conversation How To Calculate The Sum Of Values In An Array ?

When I do dd($request->all()); in controller. Result come like this

 "product_quantity" => array:2 [▼
    0 => "23"
    1 => "32"
  ],
"invoice_no" => 3
 "loading_port" => 22

This is Storing part

$order=DB::table('orders')->update([
'invoice_no'=$request->invoice_no,
'loading_port'=$request->loading_port,
'quantity'= array_sum($request->product_quantity),
])

Actually, I want to store quantity by the sum of all product quantity

Can we use array_sum() like this or is there any better method ?

Sep
27
4 weeks ago
Activity icon

Started a new Conversation How To Save Id And Attach Id Only In Pivot Table ?

I am using this package for multi-select in Vue js There are two model using many to many relationships (Pivot Table) When I submit my form data coming like this.

 "title" => "Fight Club",
  "year" => "1996"
 "quality" => "1080p"
  "genre_id" => array:1 [
         0 => array:5 [
        "id" => 2
        "genre_name" => "Comedy"
         "status" => 1
         "created_at" => "2020-09-27T04:15:39.000000Z"
         "updated_at" => "2020-09-27T04:18:06.000000Z"
       ]
          1 => array:5 [
           "id" => 1
          "genre_name" => "Action"
            "status" => 1
           "created_at" => "2020-09-27T04:09:03.000000Z"
            "updated_at" => "2020-09-27T04:17:45.000000Z"
          ]
    ]
  

This is my Controller file. How to save id and attach id only in pivot table ?

$movie=new Movie();
        $movie->title=$request['title'];
         $movie->quality= $request['quality'];
        $movie->year=$request['year'];
        $movie->save();
        $movie->genres()->attach($request['genre_id']);
Sep
26
4 weeks ago
Activity icon

Replied to String Data, Right Truncated: 1406 Data Too Long For Column 'image' At Row 1

@automica

$file = base64_decode($request['image']);
        $folderName = 'public/uploads/';
        $safeName = str_random(10).'.'.'png';
        $destinationPath = public_path() . $folderName;
        $success = file_put_contents(public_path().'/uploads/'.$safeName, $file);
        print $success;

Your code worked for me But images did not save in the folder only save image name save only in the database What should I do to save names in the database and image in the file?

Activity icon

Replied to String Data, Right Truncated: 1406 Data Too Long For Column 'image' At Row 1

@automica @artcore I change my controller like this but throws Undefined offset: 1". Is there any mistake or?

$base64_image = $request->get('image');

            if (preg_match('/^data:image\/(\w+);base64,/', $base64_image)) {
                $image = substr($base64_image, strpos($base64_image, ',') + 1);
                $image = base64_decode($image);
            }
                $name = time().'.' . explode('/', explode(':', substr($image, 0, strpos($image, ';')))[1])[1];
            \Image::make($request->get('image'))->save(public_path('backend/images/').$name);
Activity icon

Replied to String Data, Right Truncated: 1406 Data Too Long For Column 'image' At Row 1

@automica thanks, I use text but still giving that error When I put console.log('this.image') then this type of format is coming.I think this is not the type of format it should have come ?


"data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/7QCcUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAIAcAmcAFEs2YTl0UTBTV05EUVZkaGthVXhnHAIoAGJGQk1EMDEwMDBhYzMwMzAwMDA0ZTMyMDAwMDM0NmMwMDAwYWY3MDAwMDBkZDc1MDAwMDQxOGMwMDAwNDBlMDAwMDAwZmViMDAwMGExZjMwMDAwNjNmYzAwMDA3OWJhMDEwMP/iAhxJQ0NfUFJPRklMRQABAQAAAgxsY21zAhAAAG1udHJSR0IgWFlaIAfcAAEAGQADACkAOWFjc3BBUFBMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD21gABAAAAANMtbGNtcwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACmRlc2MAAAD8AAAAXmNwcnQAAAFcAAAAC3d0cHQAAAFoAAAAFGJrcHQAAAF8AAAAFHJYWVoAAAGQAAAAFGdYWVoAAAGkAAAAFGJYWVoAAAG4AAAAFHJUUkMAAAHMAAAAQGdUUkMAAAHMAAAAQGJUUkMAAAHMAAAAQGRlc2MAAAAAAAAAA2MyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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pbKOjuriXIHBovscP0qkVXFUNgMR0DJpzGrRUKXiflVWW8ya+rg7C2mZiwTmD9Bl3yGxZQpbRDKqEZtaKzOYZWfRRhR01Kli7RbBpe+ay+380xugaISpdRseh/k1JJm0N0UQFKuVOe3aEv3zl0Vky68tVdSGacunO9Mkzqrq86JqmSldQYQGliQ0FXUDLpbDH5aXseblTo7PoyLZpYKya4Ny6+MdjkdBJo2SRnx68wDs/RVjl2cTlb8CWYmFdMqyq4kqFgYGr0GXct52oiLJYegBFseuAW0BOUs1vLantJtLVhW8iVjero0xdCKSKWuhIvOY/YofeDopyc3fUc3fgQvaVkNFlYE5nS4le2IS+184qugRISpJGx+fR5dXUmLQkJUqZqrEsdNjVs6cqIbQ8mvJQyjhmnLqzrRdTO6IbzomLYpSSGEDLKq6QV4/Ozfo/M81eejhCNRqZDMxrsuLcTRj3KebQqE2OopMyl1TTN106BJZGnnUmKW0W1R0USSiXdF68fqBqjVLcECUDicrqYjHeigm5kLvxZjMvpufvFctggeiN8lJZYknGBoDIbQ5eY7Y8Kjo3zCXoZwtNBZKI1LxdEK5+Nsw2e+Kr... (10025 total length)"
Activity icon

Started a new Conversation String Data, Right Truncated: 1406 Data Too Long For Column 'image' At Row 1

This is my image uploader with image preview

 <form @submit.prevent= "createImage()" enctype="multipart/form-data">
        <input type="file" v-on:change="onImageChange" class="form-control">
         <div v-if="image">
               <img :src="image" >
          </div>
       <button type="submit">Submit</button>
  </form>

This is my script file

 methods:{
        onImageChange(e) {
            let files = e.target.files || e.dataTransfer.files;
            if (!files.length)
                return;
            this.createImage(files[0]);
        },
        createImage(file) {
            let reader = new FileReader();
            let vm = this;
            reader.onload = (e) => {
                vm.image = e.target.result;
            };
            reader.readAsDataURL(file);
        },
         createImage(){
          axios.post(`imageUpload`,{
                image:this.image,
        } 
     }

Actually, In Migration

 $table->string('image');  

It throws an error (data too long for columns). Actualy When I put console.log(this.image)

image:"data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAAQABAADasdasd..." in this format but long format 

So should change my migration file string into text ?

Sep
25
1 month ago
Activity icon

Started a new Conversation My Vue Js Route Is Not Working In Laravel ?

I have installed Vue router

npm install vue-router

//In package.json
"vue-router": "^3.4.4"

In App.js, I have import like this

import VueRouter from 'vue-router'
Vue.use(VueRouter);

const router = new VueRouter({
    routes,
    mode: 'hash',
});
//If i remove this then (Unknown custom element: <category>)  error will thrown
Vue.component('example-component', require('./components/ExampleComponent.vue').default);
Vue.component('category', require('./categories/CategoryComponent').default);
//Routes
import { routes } from './routes';

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

In route.js

import Dashboard from './components/ExampleComponent'
import Category from './categories/CategoryComponent'


export const routes = [
    {
        path:'/dashboard',
        component:Dashboard
    },
    {
        path:'/categories',
        component:Category
    },

];

In Category Component

<template>
         <router-link to="/dashboard">Dashboard</router-link>
</template>

In the dashboard blade file

@extend('layout.app')
 @section('content')
        <router-view></router-view>
@endsection

Now my problem is Suppose there is this URL http://127.0.0.1:8000/categories#/ and the page goes to CatergoyComponent and when I click the button Dashboard in CategoryComponent Only Url Change http://127.0.0.1:8000/dashboard#/ but the page remains the same as categories Component. until I refreshed. what did I do wrong?

Activity icon

Replied to How To Write Blade View With Pagination

@wahyu_87

@foreach($datas as $key => $data)
  <tr>
     @if ($key == 0 || $key % 3 == 0)
         <td rowspan="3">{{$data->article_name}}</td>
     @endif
     <td>{{$data->article_name}}</td>
    
  </tr>
@endforeach
Sep
24
1 month ago
Activity icon

Awarded Best Reply on Eloquent When Condition Question...


$type=$request->get('type');
$postcode= $request->get('postcode');
$min=$request->get('min');
$max=$request->get('max');

$properties = Property::with('images')
            ->where(function ($query) use  ($type,$postcode,$min,$max) {
           if(!empty($type))
              $query->where('type', $type);
           if(!empty($postcode))
            $query->where('postcode', $postcode;
            })
          if(!empty($max) && !empty($min))
           $query->whereBetween('rent', [$max, $min]);
            })
             ->paginate(15);
Activity icon

Replied to Vue Packages Version Mismatch In Laravel

@drehimself yeah it worked Thank you

Activity icon

Replied to Vue Packages Version Mismatch In Laravel

@drehimself can I update my vue-template version like this?

npm install [email protected]
Activity icon

Started a new Conversation Vue Packages Version Mismatch In Laravel

Vue packages version mismatch:

How should I solve it?

Activity icon

Replied to GET Method Is Not Supported For This Route. Supported Methods: POST.

Route::match(['get','post'],'/getToken','[email protected]');

in Controller

public function getToken(){

//POST METHOD
if($request->isMethod('post'){
$data=$request->all();
}
//GET METHOD
$data=DB::('posts')->get();
return view('admin.view',compact('$data'));
}
Activity icon

Awarded Best Reply on Seeders Not Inserting Values In DB

@sauravs012

did you call this   $this->call(AlgroithmTableSeeder::class);   //Seeder Name

in database seeder
Activity icon

Replied to Eloquent When Condition Question...


$type=$request->get('type');
$postcode= $request->get('postcode');
$min=$request->get('min');
$max=$request->get('max');

$properties = Property::with('images')
            ->where(function ($query) use  ($type,$postcode,$min,$max) {
           if(!empty($type))
              $query->where('type', $type);
           if(!empty($postcode))
            $query->where('postcode', $postcode;
            })
          if(!empty($max) && !empty($min))
           $query->whereBetween('rent', [$max, $min]);
            })
             ->paginate(15);
Activity icon

Replied to Eloquent When Condition Question...

@theunforgiven if it works Sir, You have to. I used this type of query for large and advanced filter & it worked for me

Activity icon

Replied to Eloquent When Condition Question...

@theunforgiven Try this

$type=$request->get('type');
$postcode= $request->get('postcode');

$properties = Property::with('images')
            ->where(function ($query) use  ($type,$postcode) {
           if(!empty($type))
              $query->where('type', $type);
           if(!empty($postcode))
            $query->where('postcode', $postcode;
            })
             ->paginate(15);
Activity icon

Replied to Swal Not Defined Laravel

@kikogyh add the CDN links in the head section

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/6.6.9/sweetalert2.min.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/6.6.9/sweetalert2.min.js"></script>
@section('scripts')
    @if (alert()->ready())
        <script>
            swal({
                title: "{!! alert()->message() !!}"
            });
        </script>
    @endif
@endsection

but the specification is PHP Version: 7.1.9 Try this

Activity icon

Replied to How To Build Query For Google Bar Chart In Laravel?

@a4ashraf Actually Population is an attribute I have appended in the model with some query. So i think i cannot use select('population') like this or pluck ('population') like this . Can i ? Thank your for responding

Sep
23
1 month ago
Activity icon

Started a new Conversation How To Build Query For Google Bar Chart In Laravel?

My Database looks like this

id  | country_name | population | created_at
 1  | USA          | 2000000000 | 2020-02-04
 2  | China        | 2200000000 | 2020-02-04
 3  | Russia       | 12000000   | 2020-04-02

My Query look like this. I am just trying to build query but not getting result.Maybe there are some mistake.

public function barChart(){
         $countries=Country::get();
         $graphic_header=['Year'];   
         $countrydata=[];
         $actionDate=[];
         $country_name=[];
       foreach ($countries as $country) {
           array_push($country_name, $country->name);
           array_push($actionDate, date('Y', strtotime($country->created_at)));
           $actionDate = array_unique($actionDate);
       }
       $graphic_header=array_merge($graphic_header,$country_name); //Dynamic Header
       array_push($countrydata,$graphic_header);
      foreach($actionDate as $d) {
          $d = [$d];
          $d = array_pad($d, sizeof($graphic_header), 0);
          array_push($data, $d);
      }
      foreach ($countries as $country){
          $date = date('Y', strtotime($country->created_at));
          foreach ($data as $in =>$gd){
              if ($date == $gd[0]) {
                  $index = (array_search($country->country_name, $graphic_header));
                  $country_data[$in][$index] = $country->population;
              }
          }
      }
          return response()->json([
           'data'=> $country_data,
           ]);
    }

I am sorry I cannot put image of bar chart how I want to draw But I am getting Result like this

array:2 [▼
  0 => array:4 [▼
    0 => "Year"
    1 => "USA"
    2 => "China"
    3 => "Russia"
  ]
  1 => array:4 [▼]
 0 => "1970"
    1 => 0
    2 => 0
    3 => 0
]

But I want data like this

['Year', 'USA', 'China','Russia'],
 ['2004',  2000000000, 2400000000 , 194500000],
Activity icon

Replied to Call To A Member Function AddEagerConstraints() On Integer

@sinnbeck can I ask you a question?

What if I need to use select() for stock and name only? like

$products=Product::select('stock','product_name')->get();

I think error will come like a column not found (stock) or something? or is there any way so I can send stock and name only ?

Activity icon

Replied to Call To A Member Function AddEagerConstraints() On Integer

@sinnbeck It worked. Thank you so much sir.

Activity icon

Replied to Call To A Member Function AddEagerConstraints() On Integer

@sinnbeck

Then How I can I send like this

Product  | Stock 
  Laptop | 23
 Mobile  | 8

but in the blade file, I have already manage like this

@foreach($products as $product)
<td>{{$product->name}}</td>
<td>{{product->getStock()</td>
@endforeach
 result will come like above table

So how can I send data like above but in JSON data?
I hope you understand my question, sir?
Thanks for responding
Activity icon

Started a new Conversation Call To A Member Function AddEagerConstraints() On Integer

 I have a  model like this
public function getOrder(){
 //Query
  return order;
}
//Calculation
 public function getStock(){
   return $this->getOrder() + (10*0.2);
 }

So In Controller, i need to send data but error occurs like call to a member function addEagerConstraints() an integer.I need to fetch data in external API project .
 
 public function apiData(){
  $products=Product::with('getStock')->get();
    return response()->json([
    	'data'=>$products
     ])
  }

But I do like this 
public function apiData(){
  $products=Product::with('getStock')->get();
	foreach($products as $product){
		 dd($product->getStock()); 
       }
    return response()->json([
    	'data'=>$products
     ])
  }

Then Result will come like -3.0
I need to fetch data in external API project .So i need to send those products and individual Stock Value of its products in API. So
Sep
22
1 month ago
Activity icon

Replied to How To Count Product With Respect To Categories Using Query Builder?

@marianomoreyra Leave it for now. Now it's giving the expected result but I am worried when there will be more that 5000 data.I hope this query work in future.

Thanks Brother