deepu07

deepu07

Member Since 2 Years Ago

Experience Points
28,830
Total
Experience

1,170 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
234
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 6
28,830 XP
Oct
17
3 weeks ago
Activity icon

Replied to Laravel Custom Validation Rule Not Working

I'm assigning output of streams to $collection i.e. $Collections = json_decode(Request::get('streams'), true);

Activity icon

Replied to Laravel Custom Validation Rule Not Working

@sinnbeck It is not working at all even input is not in an array still it is going through and creating a record. No validation error at all.

i.e. output of collections

array:1 [▼
  0 => array:3 [▼
    "group" => "stream"
    "url" => "sample_url"
    "type" => "photo"
  ]
]
Activity icon

Started a new Conversation Laravel Custom Validation Rule Not Working

hello mates, in my project I have created a custom validation rule somehow it is not working as expected can anyone help me on this. here is my code snippet.

//This is my rule Passes() method NewRule (function)

public function passes($attribute, $value)
    {
       $Collections = json_decode(Request::get('streams'), true);
    $types = [ 'picture', 'video', 'audio']

        if (empty($Collections)) {
                return $value = false;
    } else {
            foreach ($Collections as $Collection) {        
        if (!in_array($Collection['type'], $types)) {
                     return $value = false;
                } else {
                    return $value = true;
                }
        }
        }
    }

in my form request, I'm calling like this 'streams'=> [new NewRule]

Am I doing wrong ? I tried a couple of ways but no luck. Thanks in advance

Sep
25
1 month ago
Activity icon

Replied to How To Pass A Pivot Value To The Sync Function

@bobbybouwmann you made my day! thank you so much.

Activity icon

Replied to How To Pass A Pivot Value To The Sync Function

@bobbybouwmann Thanks for the reply. here is my actual thing

public function offers()
    {
        return $this->belongsToMany(Offer::class, 'offer_user')->withPivot('author_id');
    }

where my pivot table has three columns users_id, offer_id, and author_id. I wanna use sync function to fill all the column values I was doing like this but no luck at all.

$user->offers()->sync($request->offer, ['author_id'=>$request->author_id]);

I didn't find a similar solution or I may be confused.

Activity icon

Started a new Conversation How To Pass A Pivot Value To The Sync Function

Hello, In project trying to use sync function over the attach function. somehow it is working as expected. Any help that would be great. Thanks.

$user->offers()->attach($request->offers, ['author_id' => $request->author_id]); (working) I wanna use sync for this scenrio tried in various ways but no luck.

Sep
24
1 month ago
Activity icon

Replied to Laravel Sync Function With Pivot

somehow it is not saving to the db. ;)

Activity icon

Started a new Conversation Laravel Sync Function With Pivot

Hello mates,

this is my relationship

public function offers()
    {
        return $this->belongsToMany(Offer::class, 'offer_user')->withPivot('author_id');
    }

syncing like this $user->offers()->sync($request->offers);

but getting an error that author_id is the null value in sync call. how to pass author id through sync function? any help that would be great. Thanks

Sep
10
2 months ago
Activity icon

Started a new Conversation How To Get A Column Names By Using Model

Hi Folks, In my project, I wanna get all the table column names by passing the model name. How can I achieve that in Laravel? Any help that would be great. Thanks.

Activity icon

Replied to Laravel Search

Thanks @snapey

Activity icon

Started a new Conversation Laravel Search

Hello mates, I have a quick question "is it a good choice to use cache system for search feature"? Any suggestion that would be great for me. Thanks!

Activity icon

Replied to Laravel Paginate With Limit

NVM I got this

$results = $query->orderBy($filter, 'DESC')->limit(500)->paginate(20);
Activity icon

Started a new Conversation Laravel Paginate With Limit

Hello mates, In my project I'm writing a search functionality where I wanna Limit the results 500 and paginate first 20 results and send to UI. How can I do that? I'm doing like this but still getting all the 500 results set

$results = $query->orderBy($filter, 'DESC')->take(20)->limit(500)->get();

Any help that would be great. Thanks!

Sep
06
2 months ago
Activity icon

Started a new Conversation Site Not Loading In AWS

Hello guys, A quick question I have deployed my site in aws (ec2-rds). it was working until yesterday somehow today onwards, if I hit domain name in browser it is keep loading all the time. whats causing this issue any help/suggestions that would be great. Thanks!

Aug
29
2 months ago
Activity icon

Replied to Laravel Collection To Object

@hondnl Loop array and convert in looping from array to object i.e. $collection->first();

Activity icon

Replied to Update In Laravel API

@pn whenever user hit on Post update button you jus grab the id of the post and send it to the Backend. I believe without processing a Get request you have it id already with you.

Activity icon

Replied to How To Structure This Relation?

@ranx99 So here you need to check with every model before retrieving. I think create one to one model relationship and pass a string along with the input. so based on string it will go and display into that model.

Aug
20
2 months ago
Activity icon

Started a new Conversation ERR_CONNECTION_RESET

Hi Guys, I have a quick question Ive created an admin panel(Laravel+vue) so admin will update a pdf document through panel so my logic will convert each pdf page into the image and save into AWS s3 bucket. everything woking great. but the problem is I can upload a document from my location (USA) it is going through. But If someone who is out of the USA he is not able to upload a document at all. He is getting an error like this `ERR_CONNECTION_RES. Do you guys have any idea why it is making noise / how to fix this issue? Any help/suggestions that would be great. Thanks!

Aug
19
2 months ago
Activity icon

Replied to Passing Data As Array

@sarahs74 try this

return Type::create([$client_id, $type, $name]);
Activity icon

Replied to How Should I Don't Show Login Form Of Teacher If Already Logged In As Student?

@afrasiyabhaider write a condition in your controller/route/blade if a logged user is student jus redirect to the home page. ^

even you can do like this pretty clean visit this https://stackoverflow.com/questions/30643810/restrict-route-access-to-non-admin-users

Aug
16
2 months ago
Activity icon

Replied to Eloquent Builder: Where Inside Where Statement

@andrewk Try like this

Products::whereIn('id', function($query){
    $query->select('paper_type_id')
    ->from(with(new ProductCategory)->getTable())
    ->whereIn('category_id', ['223', '15'])
    ->where('active', 1);
})->get();
Aug
13
2 months ago
Activity icon

Replied to Localization Series

+1

Aug
12
3 months ago
Activity icon

Replied to Attach Method (Saving Id's In Pivot Table)

$book->students()->updateExistingPivot (
            $student_id,
            ['author_id' => $request['author_id']]
        );

this will do the trick. Thanks again.

Activity icon

Replied to Attach Method (Saving Id's In Pivot Table)

@tykus So If I Want to update existed pivot table record which one you will suggest writing an attach()or updateExistingPivot()?

Activity icon

Replied to Attach Method (Saving Id's In Pivot Table)

@tykus quick question... also the same trick works for updateExistingPivot() method?

Activity icon

Replied to Attach Method (Saving Id's In Pivot Table)

@tykus Thanks a lot. you made my day!

Activity icon

Replied to Attach Method (Saving Id's In Pivot Table)

@tykus My pivot table has 3 columns i.e. book_id, student_id author_id. I want to add three ids to the pivot table.

Activity icon

Started a new Conversation Attach Method (Saving Id's In Pivot Table)

Hello Folks, In my project I'm trying to use attach method somehow getting a weird error. i.e.

SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "author_id" violates not-null constraint DETAIL: Failing row contains (41, 1, null). (SQL: insert into "book_student" ("book_id", "student_id") values (41, 1), (41, 1), (41, 1))

Here are my logic and relationship

Book.php (Model)

public function students()
{
      return $this->belongsToMany(Student::class, 'book_student')->withPivot('author_id');
 }

Logic

$book = Book::find($id);
$author_id = 1;
$student_id = 1; 

 $book->students()->attach ([
                $book->id,
                $student_id,
                $author_id
            ]);

Am I doing wrong here? Confused I don't know why I'm getting that error back. Any help that would be great.Thanks in advance

Aug
11
3 months ago
Activity icon

Replied to Laravel Postman Auth

nvm. I got it.

Activity icon

Started a new Conversation Laravel Postman Auth

Hello guys, In my project I'm using Laravel (web, auth) routes. I was trying to get data from routes by passing my email and password in postman headers. somehow it is not going through. Here I'm just using email & password to authenticate the user (using Laravel PHP artisan make: auth). Am I doing correct ? or how to authenticate the user by passing my email and password in Postman?

Aug
10
3 months ago
Activity icon

Started a new Conversation (failed) Net::ERR_CONNECTION_RESET

Hello Folks, In my project (Laravel+Vue.js) I'm uploading 7mb pdf document to the AWS s3 bucket. somehow for a POST request, I'm getting an error like this in the browser. Any idea how to fix this error? Thanks in advance

(failed)
net::ERR_CONNECTION_RESET
Jul
28
3 months ago
Activity icon

Started a new Conversation Laravel Service Layer B/w Two Systems

Hello guys, In my project I wanna create a service layer between two systems. two systems should be in the auto sink for every request. Where can I start and where is the best place to create a service layer in Laravel? any help/suggestions that would be great. Thanks in advance

Jul
27
3 months ago
Activity icon

Started a new Conversation Stacked Chart Vue-chart.js

Hello All, In my project I'm trying to display a stacked chart. somehow it is displaying a bar chart. can anyone help me with this? Thanks in advance. Here is my files

BarChart.js

import {  Bar, mixins } from 'vue-chartjs'
const { reactiveProp } = mixins

export default {
  extends:  Bar,
  mixins: [reactiveProp]
}
<template>
    <div class="barChart col-md-6">
      <bar-chart :chart-data="barchartDatacollection"></bar-chart>
      </div>
  </div>
</template>

<script>
import BarChart from "./BarChart.js";

export default {
  components: {
    BarChart
  },
  data() {
    return {
      barchartDatacollection: { labels: [], datasets: [], options: {} }, 
     
    };
  },
  mounted() {
    this.barchartdata();
  },
  methods: {
    barchartdata() {
      this.barchartDatacollection = {
        labels: [
          "January",
          "February",
          "March",
          "April",
          "May",
          "June",
          "July",
          "August",
          "September",
          "October",
          "November",
          "December"
        ],

        datasets: [
          {
            label: "Bad Style",
            data: [40, 47, 44, 38, 27],
            backgroundColor: "#512DA8",
            hoverBackgroundColor: "#7E57C2",
            hoverBorderWidth: 0
          },
          {
            label: "Warning",
            data: [10, 12, 7, 5, 4],
            backgroundColor: "#FFA000",
            hoverBackgroundColor: "#FFCA28",
            hoverBorderWidth: 0
          },
          {
            label: "Error",
            data: [17, 11, 22, 18, 12],
            backgroundColor: "#D32F2F",
            hoverBackgroundColor: "#EF5350",
            hoverBorderWidth: 0
          }
        ],
        options: {
          scales: {
            xAxes: [
              {
                stacked: true,
                // gridLines: { display: true }
              }
            ],
            yAxes: [
              {
                stacked: true
              }
            ]
          },
          legend: { display: true }
        }
      };
    }
  }
};
</script>
Jul
22
3 months ago
Activity icon

Started a new Conversation How To Block Some Specific Routes Exculesly In Prod Env

Hello guys, In my project I wanna block some specific routes exclusively in Prod Env. How can I achieve that? Any suggestions that would be great. TIA

Jul
21
3 months ago
Activity icon

Replied to Copy Or Move Storage/books/images Files To Aws S3 Bucket

I did like this

for ($x = 1; $x <= $totalPages; $x++) {
            $Imagepath = storage_path() . '/books/images/' . $yearMonth . '_' . $request->language . '/' . $yearMonth . '_' . $request->language . $x . '.jpg';
            $files = File::get($Imagepath);
            Storage::disk('s3')->put('images/' . $request->language . '/' . $yearMonth . '_' . $request->language . $x . '.jpg', $files);
        }
Activity icon

Replied to Copy Or Move Storage/books/images Files To Aws S3 Bucket

@rameezisrar I did like this so it is working fine

 $path = storage_path() . '/books/images/' . $yearMonth . '_' . $request->language . '/' . $yearMonth . '_' . $request->language. '1.jpg';
 $files = File::get($path);
   
 Storage::disk('s3')->put('images/'. $request->language . '/' . $yearMonth . '_' . $request->language.'1.jpg', $files);

Thank you so much now I have to do is foreach the images.

Activity icon

Replied to Copy Or Move Storage/books/images Files To Aws S3 Bucket

Apparently tried above suggested methods somehow getting an error. I don't understand how to get a single file content. it is throwing an error If tried to get content of file.

Activity icon

Replied to Copy Or Move Storage/books/images Files To Aws S3 Bucket

@rameezisrar ended up doing like this but still no luck

$path = storage_path() . '/books/images/' . $yearMonth . '_' . $request->language;
        $files = File::allFiles($path);
        if (sizeof($files) > 0) {
            $disk = Storage::disk('s3')->url('images/' . $request->language . '/' . $book->real_name);

            foreach ($files as $file) {
                $path_info = pathinfo($file);
                $file_name = $path_info['filename'] . '.' . $path_info['extension'];
                $disk->putFileAs($file_name, file_get_contents($file), 'public');
            }
        }
Jul
20
3 months ago
Activity icon

Started a new Conversation Copy Or Move Storage/books/images Files To Aws S3 Bucket

Hello guys, In my project I'm trying to move/copy my storage/books/images has 60 images in it. I want to transfer all images to aws s3 bucket. I'm doing like this but somehow it is not working as expected. can anyone help me on this?

$path = storage_path() . '/books/images/' . $yearMonth . '_' . $request->language;
$files = File::allFiles($path);
        foreach($files as $file) {
            $imagefilePath = 'images/' . $request->language . '/' . $book->real_name;
            $image_destination_path = Storage::disk('s3')->url($imagefilePath);  
            Storage::disk('s3')->put($image_destination_path, $file);
        }

Thanks in advance

Jul
17
3 months ago
Activity icon

Started a new Conversation Message: "Serialization Of 'Illuminate\Http\UploadedFile' Is Not Allowed"

Hello guys, In my project I'm trying to convert pdf to jpg and saving in aws (using spatie pdf to image package) so uploading pdf logic is in my controller after 10 mins delay I'm converting pdf to images by processing laravel job. here is my laravel-job logic

public function handle()
    {
        $filePath = 'images/' . $this->request->language . '/' . '_' . $this->request->language;
        $bookPath = $this->book->path;
        $destination_path = Storage::disk('s3')->url($filePath);
        
        $pdf = new Pdf($bookPath);
        $pdf->saveAllPagesAsImages($destination_path);
        return response()->json(['status' => 'True', 'msg' => 'Successfully converted']);
    }

somehow I'm getting Serialization of 'Illuminate\Http\UploadedFile' is not allowed" error. can anyone help me out? Thanks In advance.

May
31
5 months ago
Activity icon

Replied to Building Nested Array Within Nested Array .

@ncltours if you share in github I can take a look.

May
30
5 months ago
Activity icon

Replied to PDF To Charts In Laravel

@laravel-developer look into this https://stackoverflow.com/questions/52118541/laraveltrying-to-generate-pdf-with-charts-but-on-generated-pdf-charts-are-not-s hope it will useful for you. Personally I'm using https://www.chartjs.org to display the bar/graphs in FE.

Activity icon

Replied to Building Nested Array Within Nested Array .

@ncltours from above post what I'm understanding is you wanna display a roomRates array under the accommodation array . so that means accommodation array may have more than one roomRates array in it? or single array??

Activity icon

Replied to Undefined Variable Count

@remanbala If you want you can this way as well.

$todo = Todo::all();
$todo->count();

try this one?

Activity icon

Replied to Laravel Queue Failure Does Not Trigger Failed() Method If There's An Exception, But RaiseFailedJobEvent() Works

@mkrell Thanks for reply. I figure it out that guy FYI. It is working for me. I'm just firing an event whenever job gets failed.

May
23
5 months ago
Activity icon

Started a new Conversation How To Fire An Event Whenever Job Gets Failed

Hi guys I wanna fire an event whenever laravel job gets failed. I’m trying to use

public function failed(Exception $exception)
    {
        event(new JobFailed($exception));
    }

Somehow it is not firing. do you guys have any idea why it is not firing?

May
15
5 months ago
Activity icon

Started a new Conversation Laravel Jobd

Hi guys, how to return/send response from job to controller in laravel?