princeoo7

princeoo7

Member Since 2 Years Ago

Experience Points
4,460
Total
Experience

540 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
12
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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
4,460 XP
Oct
15
1 month ago
Activity icon

Started a new Conversation How To Create Fake Blog Content With Html Code And Not Real Text In Faker

i wan to generate random blogs for testing. the issue is that with faker i am able to generate real text but it's just plain text and don't contain html tags. as per faker doc we have htmlLorem but i have not used it as it will generate form html and header which is what i don't want.

is their a way to achieve this in laravel ?

Oct
13
1 month ago
Activity icon

Replied to Where Clause On Eloquent Relation Returns Data Even On False Condition

how will it work here ? i am unable to understand it from the document base.

public function scopeHaveChildren($query){
    return $query->where(['status' => 1, 'is_parent'=> 1]);
}

public function children()
{
    return $this->scopeHaveChildren()->hasMany(Category::class, 'parent_id');
}

Activity icon

Replied to Where Clause On Eloquent Relation Returns Data Even On False Condition

that would be possible in controller but how to implement this in the model of category ?

@snapey replied above.

Oct
12
1 month ago
Activity icon

Replied to Where Clause On Eloquent Relation Returns Data Even On False Condition

@ftiersch so what is the solution her in my case ? i want apply the is_parent case on the parent and not on the children.

Oct
11
1 month ago
Activity icon

Replied to Where Clause On Eloquent Relation Returns Data Even On False Condition

below is the example where you can clearly see that is_parent is false, still it give me 2 children.

id  1
name    "Category 1"
slug    "category-1"
is_parent   "0"
parent_id   null
banner  "http://example.com/assets/images/no-img.svg"
views   "0"
creator_id  "1"
moderator_id    "1"
created_at  "2019-10-10 14:53:56"
updated_at  "2019-10-10 14:53:56"
parent  null
children    
0   
    id  13
    name    "Category 13"
    slug    "category-13"
    is_parent   "1"
    parent_id   "1"
    banner  "http://example.com/assets/images/no-img.svg"
    views   "0"
    creator_id  "1"
    moderator_id    "1"
    created_at  "2019-10-10 14:53:56"
    updated_at  "2019-10-10 14:53:56"
1   
    id  50
    name    "Category 50"
    slug    "category-50"
    is_parent   "1"
    parent_id   "1"
    banner  "http://example.com/assets/images/no-img.svg"
    views   "0"
    creator_id  "1"
    moderator_id    "1"
    created_at  "2019-10-10 14:53:56"
    updated_at  "2019-10-10 14:53:56"

Activity icon

Replied to Where Clause On Eloquent Relation Returns Data Even On False Condition

their are no conditions based on is_parent. i am just trying to fetch category with children from the same table. their are 2 column which are "is_parent" and "parent_id" that's it. and as per the code submitted above, in model i have a function called children and here i want to filter out children data only if is_parent is 1 (true) else return nothing.

Oct
10
1 month ago
Activity icon

Started a new Conversation Where Clause On Eloquent Relation Returns Data Even On False Condition

in my model, below is the code

public function children()
    {
        return $this->hasMany(Category::class, 'parent_id')->where('is_parent', 1);
    }

but i still get data for both the conditions. where is_parent == 0 and is_parent == 1.

their is data for the children for every record but i want to have a switch where if i turn it off, children should not have data.

did i miss some logic here ?

Sep
12
2 months ago
Activity icon

Started a new Conversation Custom Error Messages For Only Api For Cases Like Integrity Constraint Violations And All In Laravel 6

Coming straight to the point, how to have custom errors for the errors such as integrity violations or any such error which needs to tell user in simple words, what when wrong ...

like instead of,

{
        "success": false,
        "error": "SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry..."
}

who can i tell them

{
        "success": false,
        "error": "Your email id is already registered with us. please try to login or use forgot password to recover the account ..."
}

some thing of this sort, only on api level.

Sep
11
2 months ago
Activity icon

Replied to API Help Need In Laravel As It Returns Humans_21909=1

i when and had a conversation with the hosting team and they tested it out and it's working fine on their end. i tried testing it with mobile network and its working fine. so what exactly is going wrong ? is it on server of only network issue.

Activity icon

Replied to API Help Need In Laravel As It Returns Humans_21909=1

@snapey i am right now talking to hosting provider on the same. let me get back to you with an update :)

Activity icon

Replied to API Help Need In Laravel As It Returns Humans_21909=1

@joveice i tried it before posting , so no it's not helpful in my case...

Activity icon

Replied to API Help Need In Laravel As It Returns Humans_21909=1

that is the error i am getting on the postman posting form data. perfectly works on localhost. no error at all.

Sep
10
2 months ago
Activity icon

Started a new Conversation API Help Need In Laravel As It Returns Humans_21909=1

I am getting the following error on postman trying top post data on a live staging server api.

<script>
    document.cookie = "humans_21909=1"; document.location.reload(true)
</script>

i was getting this error on laravel 5.8 after some days but then today i uploaded the laravel 6 version code. its still the same as before. what has gone wrong ? its api so token issue shall not be their as i am trying to do a user registration.

Aug
30
2 months ago
Activity icon

Started a new Conversation Product Table Related Query !

I was trying to search for a schema for product table in laravel and found one on laravelsd.

link below:

https://laravelsd.com/share/K5oG9a

now i am confused about product, product attribute, attribute, attribue value tables.

on the other hand some thing with slight change with value for attribute been stored in the relation table of product and attribute is suggested in below link on laracast itself.

https://laracasts.com/discuss/channels/laravel/attributes-for-products-in-given-category?page=0

so what is the most efficient way to implement it then ?

Activity icon

Replied to Custom Validation Message For Unique Email Id Or Other Fields

the public funtion message () is suppose to be in the model of user for this ? because if so, it didn't worked for me as i tried.

Activity icon

Started a new Conversation Custom Validation Message For Unique Email Id Or Other Fields

I want to implement a custom error message for users email been registered with the system. below is the default error message over api. how to modify it ?

i when through this : https://laravel.com/docs/5.8/validation#customizing-the-error-messages but it bounced over my head.

{
        "error": {
            "email": [
                    "The email has already been taken."
            ]
        }
}

Aug
29
2 months ago
Activity icon

Replied to Has Anyone Worked With Laravel, Socket.io And Flutter ?

So instead of laravel echo, use laravel socket package ?

But as of now for flutter I have only seen laravel echo package been ported, will it work with your suggested package ?

Aug
28
2 months ago
Activity icon

Started a new Conversation Has Anyone Worked With Laravel, Socket.io And Flutter ?

i am currently learning how to build flutter app and was planning to implement the laravel and mysql as backend.

its not that hard unless the broadcast comes in. i haven't ever used broadcast in laravel projects as of yet.

while after searching i found that pusher is free for 100 connections and after that it's paid service. i tried to search a package for the flutter side but no relaible package is yet available.

while searching a pusher package for flutter, i stumble upon this package: https://github.com/kakajansh/echo

here it supports socket.io and pusher but pusher is yet under work. so socket.io was something i started looking into and found, it's a library and this package is a port of laravel echo which is free.

has anyone ever used this combination in a project ? any tutorial i can refer to make a flutter app with laravel , mysql and socket.io as to broadcast events or data.

by the way i was building a simple chatting app as of now while learning. it as firebase version in teaching but in future, laravel is something i am looking to use as a backend so need imput on the same for auth, data storage and notifications or real time app.

thank you for going through my request. have a nice day / afternoon / evening / night ahead :)

Aug
25
2 months ago
Activity icon

Replied to Update Images Of Image Gallery In Laravel

i can delete the old image but the issue is how to find the exact record where the image needs to be replaced. for e.g i would want to add one new image as well as update one of several old image. so even if i am checking if the request have a file or not then still how should i know if the image is for update or insert ...

Activity icon

Replied to Update Images Of Image Gallery In Laravel

mid, name, caption and alt text is what i am getting in array format and later on based on index of any one array, i can get the respective data from other arrays to that image.

this is how i know the logic. might be not so effective but if some one have any better solution. please enlighten me on the same.

Aug
24
2 months ago
Activity icon

Replied to Update Images Of Image Gallery In Laravel

also one might add a new image too while updating the gallery

Activity icon

Replied to Update Images Of Image Gallery In Laravel

$request->mid is the media id and not gallery id.

<input type="hidden" name="mid[]" :id="image.id">

this is the filed in my form.

Activity icon

Started a new Conversation Update Images Of Image Gallery In Laravel

i have created a image gallery for testing purpose and creating one is working, only issue is in update. i know here somewhere my i have missed something and not able to properly implement the logic. please have a look at the below code.

public function update(Request $request, $id)
{
    // return $request->all();
    $media = Media::whereId($id)->first();
    // return $media;
    $mediaItem = MediaItem::whereMediaId($id)->get();
    // return $mediaItem;
    
    if($request->hasFile('images')){            
        foreach($request->images as $key => $image){
            try {
                $item = Storage::disk('public')->put('/media',  $image);
                $media->update(['banner' => $item]);
                $mediaItem = MediaItem::create([
                    'media_id' => $media->id, 
                    'name' => $request->imgTitle[$key], 
                    'original_name' => $image->getClientOriginalName(),
                    'size' => $image->getSize(), 
                    'mime' =>  $image->getClientMimeType(),
                    'description' => $request->imgCaption[$key], 
                    'alt_text' => $request->imgAltText[$key], 
                    'type' => 'image', 
                    'view' => 0, 
                    'source_location' => 'local', 
                    'source' => $item,
                ]);
            } catch (Exception $e) {
                session()->flash('error', 'Error: '.$e->getMessage());
                dd($e->getMessage());
            }
        }
    } else {
        foreach($mediaItem as $key => $item){
            foreach($request->mid as $mkey => $mitem){
                if($item == $mitem){
                    $item->update([
                        'title' => $request->imgTitle[$key],
                        'description' => $request->imgCaption[$key],
                        'alt_text' => $request->imgAltText[$key],
                    ]);
                }
            }
        }
    }

    session()->flash('success', 'Media Gallery: '.$media->id.' Successfully Updated !');
    return redirect()->route('media.index');
}

what not working is the update where it creates a new entry where it should have updated the current one. i figured out that the issue is where i am checking it the file have been submitted or not but then how to identify which record it update.

Aug
13
3 months ago
Activity icon

Started a new Conversation Mail Suit In Laravel ?

Is it possible to have a gmail like app build in laravel ? what needs to be done ? i am not aware about this. we can use the smtp server to send email but if we want to receive email and store it for future reference how to do that ? normally our hosting already does that, how to do this in laravel like mobile app.

sorry if i might sound confused :/

Activity icon

Replied to How To Get Display Pluck Column From A Model Function In Blade File

@tdamir yes adding first() instead of get() worked :D thank you for your assistance :)

Activity icon

Replied to How To Get Display Pluck Column From A Model Function In Blade File

@tdamir : did not worked unless i added [0] after get() :/

Activity icon

Replied to How To Get Display Pluck Column From A Model Function In Blade File

ok i was trying for it and found this:

Pluck with multiple Columns

code works but don't know if this is the right way of doing it ...

public function status()
    {
        return $this->hasOne(Status::class, 'code', 'status')->select('name', 'color')->get()[0];
    }

Activity icon

Replied to How To Get Display Pluck Column From A Model Function In Blade File

this is what i get as an collection:

Collection {#363 ▼
    #items: array:1 [▼
        "green" => "Active"
     ]
}

Activity icon

Started a new Conversation How To Get Display Pluck Column From A Model Function In Blade File

I am stuck with a pretty simple and stupid problem :/

i have a function in model which fetch the name and color code related to status from db called status().

code:

public function status()
    {
        return $this->hasOne(Status::class, 'code', 'status')->pluck('name', 'color');
    }

i am using it in blade like this, as of now to see the result:

$category->status()

output is like this:

{"green":"Active"}

if i do,

$category->status()->name

i get error :

Property [name] does not exist on this collection instance.     

where am i going wrong with pluck as you can see that instead of giving me a name based keyword in result it is only fetching the value of the key.

i hope someone can help me out this is one ...

Activity icon

Started a new Conversation How Good Of A Idea Is To Make A Status Table ?

What is the best practice to have status defined in application ?

Normally I would just use binary for small projects where active and blocked status are used but what for big app ?

Does making a status table in db a good practices ?

Aug
12
3 months ago
Activity icon

Started a new Conversation Is My Code Right For Has Or WhereHas Filter On Eloquent Relationship ?

I am trying to display list of categories who have at least one post.

so how to display only categories which have active posts ? i meant below code works but is this the most efficient way of filtering ?

code in my category model:

public static function top() {
    return static::whereStatus(1)->whereHas('posts', function($q){
                $q->whereStatus(1);
        })->limit(20)->get();
    }

Aug
11
3 months ago
Activity icon

Replied to Static Method Of Model Gives Null, Passed To AppServiceProvider Boot Method For View Composer

yes i got the answer when solving other problem where i forgot to add get() method at the end. but didn't knew about take() method so will implement i now :D

Activity icon

Started a new Conversation Static Method Of Model Gives Null, Passed To AppServiceProvider Boot Method For View Composer

Well i don't know if the title is right or not but i am trying to pass data to a view i.e. sidebar and i am calling a recent method from post model which should give last 5 post but i am getting null.

here is the code:

public static function recent()
    {
        return static::whereStatus(1)->orderBy('created_at', 'desc')->limit(5);
}

Activity icon

Started a new Conversation How To Update Vue Data Variable From Laravel Blade File ?

I have app.js file in which i have a data variable for blog. i am using vue-tinymce-editor and now the issue is when i need to update the content then what should i do ? i am not using it in a vue component. but i am using it directly in laravel blade file. now the question is what to do ?

i tried making a custom section called custom-script and try to do below in my blade file.

</form>
@endsection

@section('custom-script')
    <script>
        export default {
    
            }
    </script>
@endsection

but i am getting this following error:

SyntaxError: export declarations may only appear at top level of a module

if i can update value of the data by v-model, then things will be easy but that's not working as i tried with select and here on editor.

code i am working on is like this,

<div class="mb-4">
            <label class="block text-gray-700 text-sm font-bold mb-2" for="desc">
                Body
            </label>
            <input type="text" v-model="blog" value="lorem" name="body">
            <tinymce id="d1" v-model="blog"></tinymce>
        </div> <!-- body -->

please help as i am not able to find a solution for this one at all.

Activity icon

Replied to How To Update V-model On Select Tag With Value From Php ?

i am not using vue-component. its just a simple select tag.

Activity icon

Started a new Conversation How To Update V-model On Select Tag With Value From Php ?

I am having a difficulty to bind value based on db store to select tag.

if i use v-bind, it works but then i am not able to update / change its current option, i get following error :

[Vue warn]: v-bind without argument expects an Object or Array value

(found in <Anonymous>)

and if i use v-model with

img_loc: ''

in js file, i am not getting any value selected based on data from db.

code:

<select name="banner_location" v-model="img_loc" class="block appearance-none w-full bg-white border border-gray-400 hover:border-gray-500 px-4 py-2 pr-8 rounded shadow leading-tight focus:outline-none focus:shadow-outline">
                        <option value="url">URL</option>
                        <option seleted value="local">Local</option>
                    </select>

output is blank i.e. non of the option is selected as img_loc is blank.

Activity icon

Replied to What Is The Best Approach To Use Category And Tags Together?

for now i went with one category per post and multiple tags for any post as this is what i have seen till now in majority. still wait for more inputs as to what i shall apply to my other projects under work 😀

Aug
09
3 months ago
Activity icon

Replied to Route Issue

use the name method after your route in the web.php like

Route::get('/edit_property_form','[email protected]_form')->name('upload.edit_property_form');

and when trying to access this route use it like:

{{ route('upload.edit_property_form') }}

this should work. and if you need to pass param like id, then :

Route::get('/edit_property_form/{id}','[email protected]_form')->name('upload.edit_property_form');

and when trying to access this route use it like:

{{ route('upload.edit_property_form', $record->id) }}

i hope this was useful and also do go thought the series and official documentation to know more.

Activity icon

Started a new Conversation What Is The Best Approach To Use Category And Tags Together?

My question is pretty simple and many of you will be able to answer it out for me :D

when using category and tags, i know that tags are always more than one. but should category also be more than one for a item / post / whatever you can think of in an application ?

if in the same app, their can be multiple categories to a post ( for example ) and multiple tags, then what is the difference between them ?

How to implement them properly ?

Thank you for reading my thread / post / question :) Have a nice day / night ahead :D

Aug
06
3 months ago
Activity icon

Replied to How To Have A Tags Field In Laravel Based Form ?

i am more confused over the form side,

i am maintaining a tags table for keeping them in record and attaching them to the block, which is what the package you suggested also do, i suppose.

my main problem is how to make the tag filed and execute the CRUD operation in the post form.

what code to put in form ?

Activity icon

Started a new Conversation How To Have A Tags Field In Laravel Based Form ?

Well the question is quit simple but i am pretty confused right now as i am not yet comfortable of vue as spa and frontend of laravel in single app itself due to login and token resign or verification of if the token is valid or not.

So thought of keeping it simple by using laravel itself for the backend admin panel. i am thinking of using this: https://vuejsexamples.com/a-vue-js-component-for-adding-and-removing-tags/

any other suggestions are welcomed on my end.

now i have made a form with laravel tailwindcss. so only part remaining is to have tags included.

i am using attach() to and belongsToMany relation. so how to make this work in form for below scenario's:

this is what i am doing in seeder file :

$post->tags()->attach($tagIds);

//this is what i think i would do in create form
$post->tags()->attach($request->tags);  

  1. create form:

    • when a new tag is typed and search with vuejs tag package, if not found then make it to the list and then have ability to attach it on backend with submitted form.

    • how to submit the data of vue component with the normal php submit form.

  2. Edit form:

    • Similar to create form, if needed add new tags or remove the current tags.

i am pretty confused right now on this matter. what is the best approach for this. if possible a working code/example share will be great.

thank you for going through my thread. i hope this will be able to help others also in future.

Jul
04
4 months ago
Activity icon

Replied to Paginate BelongsToMany Relationship Records If More Than Set Limit

Thank you all for a quick reply's :)

Jul
03
4 months ago
Activity icon

Replied to How Html Developer Can Work With Live Site?

with live site builder like what we have in wordpress, its only going to make the CSS and HTML rome around, but when their will be logic, you will be stuck. as the dev to look at vuejs tutorials so that in a week or so he / she can start on small to medium scale projects. it's not a big deal now a days if developer is flexible to have a positive learning attitude towards learning new things / technology.

Activity icon

Started a new Conversation Paginate BelongsToMany Relationship Records If More Than Set Limit

How do we paginate records for belongsToMany relationship ?

i was watching laracasts lesson: Laravel From Scratch: Part 31 - Sorting Posts By Tags url : https://youtu.be/Lq9rOAYW-S0

but there is not part talking about pagination for relational records : (

my code is as below:

 public function index(Category $category)
    {
        $posts = $category->posts;
        dd($posts);
        return view('pages.frontend.categories.index', compact('posts'));
    }

i get around 50 records for the current category i am checking post for. I want to have a limit of 20 record per page.

if i do :

$posts = $category->posts->paginate(20);

i get error:

 BadMethodCallException
 Method Illuminate\Database\Eloquent\Collection::paginate does not exist.

Activity icon

Replied to Get Distinct Eloquent Relation Data Count And Records In Laravel

yes that is what i was saying :)

Activity icon

Replied to Get Distinct Eloquent Relation Data Count And Records In Laravel

right now i was so confused that i thought that range(1,27) will give me a single number and not an array and so i got confused here.

i got things working but let me break it down so that it will be on record for me to refer in future and also you might be able to tell me if i understood the code and it's flow correct.

1st : gives me an number array from 1 to 27.

$categoryIds = range(1, 27);

2nd : shuffle the newly generated 1 to 27 array.

shuffle($categoryIds);

3rd : we slice the array from index 0 to the random number generate and so we get a unique length for the array for each post category.

$categoryIds = array_slice($categoryIds, rand(0, count($categoryIds) - 1));

4th: we insert / attach those ids to the post with pivot table. though i really didn't knew that an array also works as same as an object or id of the relative data. Some thing new learned today.

$post->categories()->attach($categoryIds );

let me know if i am right or not. marking your answer as correct answer :)

Activity icon

Replied to Get Distinct Eloquent Relation Data Count And Records In Laravel

Schema::create('category_post', function (Blueprint $table) {
        $table->integer('category_id');
        $table->integer('post_id');
        $table->primary('category_id', 'post_id');
    });

    Schema::create('post_tag', function (Blueprint $table) {
        $table->integer('post_id');
        $table->integer('tag_id');
        $table->primary('post_id', 'tag_id');
    });

Is this right ?

i tried that and then this happend in the seeder:

foreach (range(1, 3) as $key => $value) {
            $post->categories()->attach(mt_rand(1, 27));
            $post->tags()->attach(mt_rand(1, 27));
        }
------------------------------------------------------------------------------------------------------------------------------------------------------ 

   Illuminate\Database\QueryException  : SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'PRIMARY' (SQL: insert into `post_tag` (`post_id`, `tag_id`) values (1, 11))

Activity icon

Replied to Get Distinct Eloquent Relation Data Count And Records In Laravel

currently i am using faker to seed the db and this is what i am doing in the seeder for post:

foreach (range(1, 27) as $key => $value) {
            $post->categories()->attach(mt_rand(1, 27));
            $post->tags()->attach(mt_rand(1, 27));
        }

Activity icon

Started a new Conversation Get Distinct Eloquent Relation Data Count And Records In Laravel

i want to get distinct records inside a category.

my code in [email protected]

$posts = Category::where(['title' => request('category'),  'status' => 1])
        ->with('posts')
        ->paginate(env('RECORD_LIMIT'));

and in my category model :

public function posts()
    {
        return $this->belongsToMany(Post::class);
    }

    public static function archives()
    {
            return static::selectRaw('title')
            ->withCount('posts')
            ->get()
            ->toArray();
    }

neither the count of archive is right nor the records i am getting as their are many duplicate records. what is wrong and how to solve this issue ?