SinghWithLaravel

SinghWithLaravel

Member Since 7 Months Ago

Experience Points
6,380
Total
Experience

3,620 experience to go until the next level!

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

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
23
Lessons
Completed
Best Reply Awards
2
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 2
6,380 XP
Jul
13
3 weeks ago
Activity icon

Replied to How Can I Be A Laravel Certified Developer ?

@shez1983 You opinion is good, but when we are compared with someone who has same experience as you, than certification matters.

Jul
03
1 month ago
Activity icon

Replied to I Wanna Change CamelCase Database Field Value Using Accessor In Laravel ?

@frankielee , @ishra , @deepu07 Hii guys, I had to perform operations on two database fields, before showing in frontend, which were named as clockInTime & clockOutTime in database. For that I made accessor without adding that field in $appends. But as we know Laravel Expects database fields to be snakeCase, and we were not following that, that's why accessors were not working. To fix it, I added clock_in_time & clock_out_time in $appends, but still it didn't work. Finally, By adding public static $snakeAttributes = false;, it's accessors started working.

Thanks For Help

Jun
26
1 month ago
Activity icon

Started a new Conversation I Wanna Change CamelCase Database Field Value Using Accessor In Laravel ?

I wanna change camelCase database field value using accessor in Laravel ? How can i use Accessor with camelCase field.

field name is clockInTime, for this I made below accessors -

    public function getclockintimeAttribute($value)
    {
        return '2020-06-26 12:35:35';
    }

    public function getClockInTimeAttribute($value)
    {
        return '2020-06-26 12:35:35';
    }

None of the above methods work. What should be the method name ?

Jun
13
1 month ago
Activity icon

Replied to Location Tracking Android With Laravel

@snapey Okay, We can do it after every hour. It will be much better solution. Right ?

Activity icon

Replied to Location Tracking Android With Laravel

@bobbybouwmann , @snapey , @yusuf128 When we will hit REST Api in every minute for a single user, will it be a efficient solution ? I think, it will take a lot of resource at mobile as well as server. Is there any other way to do it efficiently ?

Activity icon

Replied to Realtime Tracker App Laravel And Android

@mohamedhassan1 Did you get the soltion ? If yes, share it with me. I am facing same problem.

Activity icon

Replied to Real Time Location Saving In Database

@deepu07 What about sockets.io ?

Activity icon

Started a new Conversation Real Time Location Saving In Database

I have an hybrid driver app, I want to capture every moment of driver's route. How can I do that ? I have heard about pusher, but i don't want something paid to be implemented. What about Sockets ? I don't know much about it, please let me know why and how I should use it. Thanks

Jun
08
1 month ago
Activity icon

Replied to Routes Not Working Anymore

@siangboon Yeah, You are damn right. @th3apprentis Check out the compatibility, whether everything is right or not server as your version.

Mar
19
4 months ago
Activity icon

Replied to How To Add A Specific Key In Each API Response.

@tykus Yup, i want to add it in payload . I am not using Laravel Resource.

Activity icon

Started a new Conversation How To Add A Specific Key In Each API Response.

I want to add a specific key in each API reponse in Laravel. How can i do that ?

Mar
06
4 months ago
Activity icon

Replied to Cannot Modify Header Information.

@verbose Did the soution worked for you ?

Mar
03
5 months ago
Activity icon

Replied to Laravel Developer Remote Jobs

@tisuchi I am going with it. let's see, how long does it takes!

Activity icon

Started a new Conversation Laravel Developer Remote Jobs

Do Anyone have any references for Laravel Developer Remote Jobs ? I would love to work on Laravel.

Activity icon

Started a new Conversation Laravel Developer Remote Jobs

Do Anyone have any references for Laravel Developer Remote Jobs ? I would love to work on Laravel.

Feb
27
5 months ago
Activity icon

Replied to Laravel 6+ Upload Multiple Images Through A Form

@seeker1337 Change $allImages = explode("|",$vehimages); like below line -

$allImages = explode("|",$VehiclesModel->vehimages);

Activity icon

Replied to Laravel 6+ Upload Multiple Images Through A Form

@seeker1337 Yeah, you can loop through the images. In that case you will have to explode it from comma like below code. -

<?php   

    foreach ($vehiclesmodel as $VehiclesModel) {
    $allImages = explode("|",$images);

?>    
    
<tr> 

    <td> {{ $VehiclesModel->id }} </td>
    <td> {{ $VehiclesModel->vehmod }} </td>
    <td> {{ $VehiclesModel->vehmark }} </td>
    <td> {{ $VehiclesModel->vehyear }} </td>
    <td> {{ $VehiclesModel->vehengine }} </td>
    <td> {{ $VehiclesModel->vehtrans }} </td>
    <td> 
    @php
        @foreach($allImages as $image)
                <img src="storage/veh-images/{{$image}}" height="50px" width="30%">
        @endforeach
    @endphp
    </td>
 
</tr>
 
<?php  }    ?>
Feb
20
5 months ago
Activity icon

Replied to I Want To Validate Route Parameter To Be One Of The Two Given Values, How Can I Do It ?

@sinnbeck I simply did it like this -

    Route::post('InspectionChecks/List/{type}', '[email protected]')->where('type',"ASSET|TRAILER");

What will regex will do here ?

Activity icon

Started a new Conversation I Want To Validate Route Parameter To Be One Of The Two Given Values, How Can I Do It ?

route::post('InspectionChecks/List/{type}', '[email protected]');

In above route, i want type to be either ASSETor TRAILER. How can we achieve it without going to the controller ?

Feb
18
5 months ago
Activity icon

Replied to [BUG REPORT] Laracasts Website

@JefferWay design problems are there.

Feb
17
5 months ago
Activity icon

Replied to Nested Relationship With GroupBy And Count

@maan56 Can't be done through relationship.

Activity icon

Replied to How Can I Run Database Migration On AWS Server Without Terminal Access ?

@hmazter It is an EC instance and using FTP for deployment.

Feb
16
5 months ago
Feb
14
5 months ago
Activity icon

Started a new Conversation How Can I Run Database Migration On AWS Server Without Terminal Access ?

Is there some other way to run migration on AWS server without using terminal access of the server ? can we do that using Artisan class like below -

Artisan::call('migrate --path=database/migrations/2020_02_13_124322_alter_tablelist.php');

I tried above command, but it didn't work.

Feb
12
5 months ago
Activity icon

Replied to How Can I Delete Data In Larvel Relation, When We Have Nested Relations ?

@sti3bas What if I Use delete() rather than destroy() ? Through, right now i am passing single id. So it is good to go for now.

Activity icon

Replied to How Can I Delete Data In Larvel Relation, When We Have Nested Relations ?

@sti3bas I don't think just to solve this problem, I should use package. I just got a solution, check it out below -

        $object=Corporation::find($id)
        ->load([
                'regions',
                'regions.districts',
                'regions.districts.locations',
        ])
        ->destroy($id);

it will delete all nested relational data and for stored documents i will prefer using your delete event.

Do you think it is a good way ?

Activity icon

Replied to How Can I Delete Data In Larvel Relation, When We Have Nested Relations ?

@sti3bas What if i have relations inside Documents as well ?

Will it be easier if i don't delete documents while deleting records ?

Activity icon

Replied to How Can I Delete Data In Larvel Relation, When We Have Nested Relations ?

@sti3bas @tohby cascade delete will work only in Hard Delete(deleting from database) while I am gonna use Soft Delete. I need solution in case of Soft Delete.

@sti3bas yeah, Deleteing documents is also an issue.

Activity icon

Started a new Conversation How Can I Delete Data In Larvel Relation, When We Have Nested Relations ?

I want to delete nested data with parent data in laravel relation. Default way of laravel hust provides one way, and that is defined below -

User::find($id)->profile()->delete();

I want to delete all documents related to the user while its deletion. I don't wanna use events, neither loops or cascade delete. I want something builtIn. Is it possible ?

Activity icon

Replied to Is It Required To Make Relation Functions In Both Models While We Just Wanna Use One Model.

@alanholmes One more thing, i want to implement soft delete in Models, so how can I check whether a specific id exists in relation or not ?

Activity icon

Started a new Conversation Is It Required To Make Relation Functions In Both Models While We Just Wanna Use One Model.

Basically i am having two models Comments and Posts.

(1) First Part - I have to access comments of a single post. For that i can make a hasMany relation function like below.

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

While accessing, i will simply call this function with post model's instance.

(2) Second Part - Is it enough to use above relation to access comments of specific post or i need to use below relation as well. In some web pages I read that I will need to define relation function in Comments model as well.

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

I think First Part is enough to get all the comments related to a post. Second part is only needed if i need to fetch the post for a specific comment, right ?

Activity icon

Replied to Store Or Update Enum Value

@kkhicher1 You can make one of the answers as Best, if you think it is.

Activity icon

Replied to Store Or Update Enum Value

@kkhicher1 Check database, whether that is following the migration or not ? Whether that is having defined enums, default value as per code or not ?

Feb
11
5 months ago
Activity icon

Started a new Conversation How To Get Soft Deleted Records From Eager Loading And Lazy Eager Loading ?

I want get deleted records eager & lazy eager loading relations. How can i achieve that ? I found some solutions on stackoverflow, which have been written below -

  1. use withTrashed() method wih relation function like below -
     public function deletedVideos() {
           return $this->hasMany(Video::class, 'deleted_by_user_id')
            ->withTrashed();
          }
        
    
  2. Use withTrashed() with after relation while calling like below -
Model::find($id)->post()->withTrashed()->get();

I want to know the solution in case, if i have many relations, what can i do ? have a look at below situation -

$assetDetails = $assetDetails->with(['assetDocuments' => function ($query) {
$query->select('id', 'assetId','assetUsage','volume','amount', 'documentType', 'links', 'link','userId', 'uploadTime', 'expiryDate','coordinate')
->orderBy('assetdocument.uploadTime', 'desc')
->get();
},'assetDocuments.userDetails:id,firstName,lastName,middleName']);
$assetDetails = $assetDetails->with(['safetyCheckListSaveInfo' => function ($query){
$query->select('id', 'assetId', 'userId', 'type','checks' , 'coordinate', 'created_at','created_at')->orderBy('created_at', 'desc');
},
'safetyCheckListSaveInfo.userDetails:id,firstName,middleName,lastName']);

How can i use soft delete with bunch of realtions ?

Activity icon

Replied to Dompdf Page Break Issue

@ajithlal @shing_shing This is still a unresolved issue dear, we are working on it.

Activity icon

Replied to How To Display HSN Code Wise Data In Laravel Using Table Format

@krishma You can use below code -

$data = Yourmodel::groupBy('hs_code')
->get();

By the above code you will get the list of grouped HSC codes. But for total, you will have to do that through you php code.

If you don't wanna get that from php code, you can hit one more query for it like below -

$data = Yourmodel::selectRaw('sum(amount)')
->groupBy('hs_code')
->get();
Activity icon

Replied to Ajax Crud

@gregers Do you want to use Sentinel as an RESTful API ?

Activity icon

Replied to Store Or Update Enum Value

@kkhicher1 It might be happening due to case difference in enum definition & update value. Make sure they are same.

Activity icon

Replied to Store Or Update Enum Value

@kkhicher1 Can you post your enum values here, which you have set in database and migration ?

Activity icon

Replied to Store Or Update Enum Value

@kkhicher1 Can you put your enum values here ?

Activity icon

Replied to Store Or Update Enum Value

@kkhicher1 What is the default value which is getting saved while updating ?

Activity icon

Replied to Store Or Update Enum Value

@kkhicher1 What is the default value which is getting saved while updating ?

Activity icon

Replied to Store Or Update Enum Value

@kkhicher1 if you will not set anything anything while updating, it will update value to default.

Activity icon

Replied to Store Or Update Enum Value

@kkhicher1 Are you getting value in below fields -

$request->religious
$request->caste

Firstly make sure they are getting values or not, keep cache cleared ever.

And why are you using ?? in code ? Are you trying to use ternery operator ?

Activity icon

Replied to Store Or Update Enum Value

@kkhicher1 Which field is having enum value ?

Activity icon

Replied to How To Display HSN Code Wise Data In Laravel Using Table Format

@krishma If i am not wrong karishma, you want to group data on the basis of HSN code & show the sum of the amount for specific HSN code. For that you can simply use groupBy() data and select the sum of data here.

Feb
06
5 months ago