david001

david001

Member Since 4 Years Ago

Experience Points
12,120
Total
Experience

2,880 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
3
Lessons
Completed
Best Reply Awards
1
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 3
12,120 XP
Mar
30
16 hours ago
Activity icon

Started a new Conversation Unserailize Cart Items

I have orders table and in orders table i have id,user_id,cart,timestamps

now i want to show name of user and the items purchased by him/her. Items in cart are serialize.


O:8:"App\Cart":3:{s:5:"items";a:3:{i:4;a:5:{s:2:"id";i:4;s:4:"name";s:12:"mobile phone";s:5:"price";s:3:"700";s:3:"qty";i:1;s:5:"image";s:60:"public/product/BCalVvWpyRtsE5qo6AYoGYaxEFFSi4PstWJL9bn1.jpeg";}i:6;a:5:{s:2:"id";i:6;s:4:"name";s:15:"Lenovo ThinkPad";s:5:"price";s:3:"777";s:3:"qty";i:1;s:5:"image";s:60:"public/product/xa6HX9dvWxo1ZT0lGebO8PtWmg8NKEauvJHC4PjX.jpeg";}i:7;a:5:{s:2:"id";i:7;s:4:"name";s:20:"HP Pavilion x360 14m";s:5:"price";s:3:"988";s:3:"qty";i:1;s:5:"image";s:60:"public/product/vJPNnJohM5f1OSzghA6O7qtZLBEi8QmHkgroxkZh.jpeg";}}s:8:"totalQty";i:3;s:10:"totalPrice";i:2465;}

In User.php


public function orders(){
        return $this->hasMany('App\Order');
    }

orders table

user_id  | cart
2		serailize items
4		serailize items

How do i know which user has produced what items and show them in view. any help would be highly appreciated

Mar
26
4 days ago
Activity icon

Started a new Conversation How To Upload Larger File Such As Mp3 And Video

Hi, i tried to upload a mp3 but i got an error


The file "bensound-summer.mp3" exceeds your upload_max_filesize ini directive (limit is 2048 KiB).

I am using mac and xampp server. In my php.ini file i changed

post_max_size=129M to post_max_size=2048M```

and made 

upload_max_filesize=2048M```

But still I am getting same error on upload

Activity icon

Started a new Conversation Code To Upload Audio

This code given below uploads the image but when i try to upload audio(mp3) it gives me error undefined variable audio


    public function store(Request $request)
    {
        if($request->hasFile('audio')){
            $audio = $request->file('audio')->store('music');
        }
        Music::create([
            'title'=>$request->title,
            'description'=>$request->description,
            
            'audio'=>$audio


        ]);
        return redirect()->back();
    }

Can anybody help to upload audio. Thanks

Mar
23
1 week ago
Activity icon

Started a new Conversation Disqus Show Same Comments In All Posts

Hi , I am using disqus comment system in my vue template as below. How can i get idetifier and url in vue template for disqus , I think that can solve my problem. https://disqus.com/


<div class="comments">
    <vue-disqus shortname="laraveldisqus" :identifier=post.id url=""></vue-disqus>
  </div>

fullcode here



<template>
	<div class="container">
		<div class="row my-4">
			<div class="col-md-8 mx-auto">
				<div class="card">
					<h2 class="
					card-header">


					{{post.title}}
					id:{{post.id}}
					


				</h2>
					<p class="p-2">
						<span class="text-default">
						{{post.user}}
						{{post.replies_count}}
						</span>
						<span class="text-danger">
							{{post.created_at}}
						</span>

						<span class="badge badge-success">
							{{post.category}}
						</span>
					</p>
					<div class="card-mg-top">
						<img style="width: 100%; height: 400px;" :src="post.photo" class="rounded shadow-sm img-fluid">
					</div>
					<div class="card-body">
						<div class="media">
							<div class="media-body">
								<p class="lead">
									{{post.body}}
								</p>
							</div>
						</div>
					</div>
				</div>
				<div class="row my-3">
					<div class="col-md-12">
						<div class="media shadow my-4 p-4" >
							<div class="media-body"
							>
							<!-- <div class="form-group">
								<div class="media shadow my-4 p-4" v-if="logged">

								<label>Comment</label>
								<textarea class="form-control" v-model="comment"></textarea>
								<br>
								<button @click="addComment(post.id)"
								 class="btn btn-primary">Submit</button>
							</div> -->

<div class="comments">
    <vue-disqus shortname="laraveldisqus" :identifier=post.id url=""></vue-disqus>
  </div>



						</div>

					</div>
					<router-link to="/login" >Login</router-link>
<!-- v-else
 -->						<h3 class="text-info mb-3">
							Comments({{post.replies_count}})
							
						</h3>
						<div class="media my-4 p-4 shadow" v-for="(comment,index) in post.comments" :key="index">
							<div class="media-body">
								<span class="text-danger">
									{{comment.user}}|{{comment.created_at}}
								</span>
								<p class="lead">
								{{comment.body.substr(0,20)}}
									
								</p>
								
							</div>
							
						</div>

					</div>
				</div>
			</div>
		</div>
	</div>
</template>

I can see disqus in my website but when i give comment to one posts it automatically appears in other page as well. can anybody help me please

Mar
14
2 weeks ago
Activity icon

Replied to How To Unserialize Data

Yes i have to unserialize , but i don't know how to do that?

Activity icon

Replied to How To Unserialize Data

@pauljp , I need to unserialize that data that is stored as serialize in cart filed on orders table. The way you mentioned is wrong, I have tired. Thanks

Activity icon

Replied to How To Unserialize Data

i want to display the data in view

Mar
13
2 weeks ago
Activity icon

Started a new Conversation How To Unserialize Data

I am developing an eCommerce application. I have store user order in Orders table where I have id/user_id/cart/create_at/updated_at field The data in the cart is serialized and as an admin I want to see which user_id or user has purchased what products. I want to show this on the view page.

My method
   public function userOrder(){
        $orders = Order::get();
        return $orders;
//return view('');
        
      }

[
{
id: 5,
user_id: 3,
cart: "O:8:"App\Cart":3:{s:5:"items";a:2:{i:5;a:5:{s:2:"id";i:5;s:4:"name";s:11:"DELL LAPTOP";s:5:"price";s:3:"799";s:3:"qty";i:1;s:5:"image";s:60:"public/product/iPhZNz1Fy9dYxAawNtVOspXvpTWvc28nFMwDTG7a.jpeg";}i:6;a:5:{s:2:"id";i:6;s:4:"name";s:15:"Lenovo ThinkPad";s:5:"price";s:3:"777";s:3:"qty";i:1;s:5:"image";s:60:"public/product/xa6HX9dvWxo1ZT0lGebO8PtWmg8NKEauvJHC4PjX.jpeg";}}s:8:"totalQty";i:2;s:10:"totalPrice";i:1576;}",
created_at: "2020-03-12 11:21:06",
updated_at: "2020-03-12 11:21:06"
},
{
id: 6,
user_id: 3,
cart: "O:8:"App\Cart":3:{s:5:"items";a:2:{i:5;a:5:{s:2:"id";i:5;s:4:"name";s:11:"DELL LAPTOP";s:5:"price";s:3:"799";s:3:"qty";i:2;s:5:"image";s:60:"public/product/iPhZNz1Fy9dYxAawNtVOspXvpTWvc28nFMwDTG7a.jpeg";}i:1;a:5:{s:2:"id";i:1;s:4:"name";s:11:"HP LAPTOPS ";s:5:"price";s:3:"877";s:3:"qty";i:1;s:5:"image";s:53:"product/yyO8bETsNup8nECU8sF0d7VBeRVbkEiQWthswpHP.jpeg";}}s:8:"totalQty";i:3;s:10:"totalPrice";i:2475;}",
created_at: "2020-03-13 09:16:58",
updated_at: "2020-03-13 09:16:58"
}
]

Please help me to display this data in view page.

Mar
06
3 weeks ago
Activity icon

Awarded Best Reply on Check Chekbox After Submitting Form

 @foreach($categories as $category)
<input type="checkbox" name="category[]"
               value="{{$category->id}}" @if(isset($filteredcategories))
               {{ in_array($category->id, $filteredCategories )? 'checked="checked"' : '' }} 
               @endif
               >
            
                {{$category->name}}
@endforeach
controller:
 Category::whereIn('id',$request->category)->pluck('id')->toArray();
Activity icon

Replied to Check Chekbox After Submitting Form

 @foreach($categories as $category)
<input type="checkbox" name="category[]"
               value="{{$category->id}}" @if(isset($filteredcategories))
               {{ in_array($category->id, $filteredCategories )? 'checked="checked"' : '' }} 
               @endif
               >
            
                {{$category->name}}
@endforeach
controller:
 Category::whereIn('id',$request->category)->pluck('id')->toArray();
Activity icon

Replied to Check Chekbox After Submitting Form

@biishmar It checked all the values. for example, my filter id for the category are 1 and 2 but I check all category with id 1,2,3, and 4 instead of checking just category id 1 and 2

Mar
04
3 weeks ago
Activity icon

Started a new Conversation Check Chekbox After Submitting Form

Hi, I am making a filter with a checkbox. once you choose the few checkboxes and submit the form I want that checkbox to be checked after the page reload.


             <form action="{{route('product.search'," method="GET">
            
            @foreach($categories as $category)
              <p><input type="checkbox" name="category[]  " value="{{$category->id}}">{{$category->name}}</p>
           
           @endforeach
          <input type="submit" value="Filter" class="btn btn-success">
         </form>

How to remember the state of checkbox even after the page is refreshed after submitting the form

Feb
28
1 month ago
Activity icon

Replied to Jquery Not Working

yes i did

Activity icon

Started a new Conversation Jquery Not Working

Hi, i want to write some logic with laravel and jquery. To test I just added this code in home.blade.php but I'm not getting any alert message. I'm using laravel 6. Please help me

@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-10 offset-md-1">
            <div class="card">
                <div class="card-header">Dashboard</div>
                
                <div class="card-body">
                    You are logged in!
         <p>Click on this paragraph.</p>
                </div>
            </div>
        </div>
    </div>
</div>

< script > $(document).ready(function(){ $("p").click(function(){ alert("The paragraph was clicked."); }); }); </ script >

@endsection

Dec
04
3 months ago
Activity icon

Started a new Conversation How To Query This

I want to hide and show delete button based on conditions I have a pivot tablequiz_user with attributes user_id and quiz_id


user_id  quiz_id
2              1
3               1

and a results table with attributes



user_id quiz_id  question_id answer_id

2       1              1                    3

Now i want to detach ids from pivot table quiz_user only if the same row of user_id and quiz_id is not in results table.

for example in quiz_user table user_id is 2 and quiz_id is 1 and this user_id 2 and quiz_id 1 is also available in results table so now I don't want to show delete button in view.

Any help?

Nov
23
4 months ago
Activity icon

Replied to How To Delete Migration File

I restarted server and tried again, now its fine. Thanks

Nov
22
4 months ago
Activity icon

Replied to How To Delete Migration File

no just one

Activity icon

Replied to How To Delete Migration File

i deleted directly from database table and i deleted same file from migration folder as well. Now i don't have that migration file but when i run php artisan migrate:fresh

it creates same table name again in database. I am suprised how it is happening even though i deleted migration file of that particular table

Activity icon

Started a new Conversation How To Delete Migration File

Hi , I am using Laravel 6. I created one new migration file. I don't need it now so I deleted it from migration folder but when I run

php artisan migrate:fresh

or

php artisan migrate

Still I can see that particular table in my database. How can i delete it permanently .

Thank you