deepu07

deepu07

Member Since 2 Years Ago

Experience Points
42,520
Total
Experience

2,480 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
260
Lessons
Completed
Best Reply Awards
12
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 9
42,520 XP
Jul
10
15 hours ago
Activity icon

Awarded Best Reply on Php Artisan Route:list -v Through Errors

@alokdev it seems like you're missing the passport oauth keys in your storage direc. make sure you do have both OAuth public and private key.

Activity icon

Replied to FormRequest For Update Call

@aurawindsurfing yeah somehow If I hit put update request in postman it is showing the homepage. looks like I'm missing something here. my validation is getting failed somehow

Activity icon

Replied to Php Artisan Route:list -v Through Errors

@alokdev it seems like you're missing the passport oauth keys in your storage direc. make sure you do have both OAuth public and private key.

Activity icon

Replied to Getting An Array Of Related Collections

@megaman try this

	$relatedRows = [];

        foreach ($model->related as $related) {
                array_push($relatedRows, $related);
        }
Activity icon

Replied to Class 'App\Http\Controllers\API\GuzzleHttp\Client' Not Found"

@msh seems like your namespace is wrong

Class 'App\Http\Controllers\API\GuzzleHttp\Client' not found

also you can do like this also

$client = new \GuzzleHttp\Client();

or import class like this use GuzzleHttp\Client;

Activity icon

Started a new Conversation FormRequest For Update Call

Hi Mates, I'm using Laravel FormRequests for validations. I'm using form-request for update request somehow it is redirecting to the homepage. also, I'm using a passport for auth. any help that would be great. TIA.

<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;

class ClientUpdateRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        $user = Auth::user();
        if ($user->user_type == 'client') {
            return true;
        }
        return false;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $client_id = Auth::user()->user_type_id;
        return [
            'first_name' => 'required|string',
            'middle_name' => 'string|nullable',
            'last_name' => 'string|required',
            'phone_number' => 'required|string',
            'email' => 'required|unique:email'.$client_id,
            'street_address' => 'required|string'
        ];
    }
}
Jul
09
1 day ago
Activity icon

Started a new Conversation JQuery Display Selected Tag For Options

Hi Mates, I was appending options like this by using jQuery. how can I pass the selected tag for options in this case? cause I have some values in my session when my session value matches multi-select value I wanna show that option is selected. TIA

$.each(res, function (data, value) {                            
     $("#student").append($("<option></option>").val(value.id).html(value.name));                       
 ) 
Jul
08
2 days ago
Activity icon

Started a new Conversation DB Design Best Practice

Hi Mates, in my project I have a requirement like counselors and clients related website. so coming to DB design I wanna create a three table one table for clients, a second table for counselors and a third table is the users. in the users' table, I just want to save the username/email/password/user_type_id. I'm just trying to understand what is the best practice for this scenario. also thinking to use a passport package for auth. so do you think is it best practice?

Activity icon

Replied to Maatwebsite/excel Create Columns Dynamically Depending On Data

@msslgomez try this and modify based on your requirements

    <body>
        <h2>{{$name}}</h2>
        <div class="row">
                <div class="table-responsive col-md-6">
                    <h2>Residential</h2>
                    <table>
                        <tr>
                            <th>First Name</th>
                            <th>Last Name</th>
                            <th>Email</th>
                            <th>Street Address</th>
                            <th>City</th>
                            <th>State</th>
                	</tr>
          
                                <tr>
                                    <td>{{ $user->first_name }}</td>
                                    <td>{{ $user->last_name }}</td>
                                    <td>{{ $user->email }}</td>
                                    <td>{{ $user->street_address }}</td>
                                    <td>{{ $user->city }}</td>
                                    <td>{{ $user->state }}</td>
				</tr>
                    </table>
                </div>
                <br>
            @endif
</div>
</body>
Activity icon

Started a new Conversation Laravel ManyTOMany Eager Loading Where Cond

Hey Mates, I'm trying to do where condition in many to many relationships on eager loading but getting an err.

$user->colleges()->with([
            'departments.subjects' => function (Builder $query) {
                $query->where('is_active', 'yes');
            }
        ])->paginate(10);

getting an err. IDK what I'm doing wrong. any help that would be great. Thanks!

Activity icon

Replied to Why I Am Getting %7D At The End Of Url By Creating A Link With Named Routes

@umairparacha can i see your routes file? anyways route should be like this

Route::get('/user/{userId}', '[email protected]');
Jul
07
3 days ago
Activity icon

Replied to How To Delete Price Of Product In Stripe By Using Api Call

@shanebarron yeah so you can't delete the price which is attached any active user/subscription. but you can archive it if you want.

Activity icon

Replied to Two Tables With Sometimes Relationship?

@ajsmith_codes seems like a fun task. but yeah my thought is to create a column type in the event table. and write rule/checks if event type is met absence conditions create a record in absence table else don't create a record in the absence table. Cheers!

Activity icon

Replied to How To Check If A URL Is An Article Or Just A Web Page?

@jeroenvanrensen if you think you can get URL extensions I guess you can write custom validations based on the extensions.

Activity icon

Replied to Laravel: One File With Two Classes?

@ninjajoe why you wanna create two classes in one file? why not two files?

Activity icon

Replied to Laravel Authentication With Username/ Email Doesn't Work

@ionpop did you check the developer console network tab too? No errors?

Activity icon

Replied to Search A List In One Input Form

@emfinanga idts cause I'm not user how many numbers he is going to enter. if not maybe you can tell the user like enter this limit of numbers or any specific format. yeah it's all custimaztion

Activity icon

Replied to Search A List In One Input Form

@emfinanga you can use ajax call whenever user enter a text in search form do ajax call get input data and add to serach box and send a submit call?

Activity icon

Replied to How Do I Extract All Tag Ids From A List Of Posts

@siempie93

$tags = $posts->pluck('tags.id');

what are you getting in result? and did you created a relationship btw posts and tags?

Activity icon

Replied to Laravel Authentication With Username/ Email Doesn't Work

@ionpop add this code to logincontroller.php that should work.

public function login(Request $request)
    {
        $email = User::where('email', $request['email'])->orWhere('user_name', $request['email'])->first();

        if($email) {
            $request['email'] = $email->email;
        }

        $this->validateLogin($request);

        // If the class is using the ThrottlesLogins trait, we can automatically throttle
        // the login attempts for this application. We'll key this by the username and
        // the IP address of the client making these requests into this application.
        if (method_exists($this, 'hasTooManyLoginAttempts') &&
            $this->hasTooManyLoginAttempts($request)) {
            $this->fireLockoutEvent($request);

            return $this->sendLockoutResponse($request);
        }

        if ($this->attemptLogin($request)) {
            return $this->sendLoginResponse($request);
        }

        // If the login attempt was unsuccessful we will increment the number of attempts
        // to login and redirect the user back to the login form. Of course, when this
        // user surpasses their maximum number of attempts they will get locked out.
        $this->incrementLoginAttempts($request);

        return $this->sendFailedLoginResponse($request);
    }
Activity icon

Replied to Update Enum Options In Postgres

@untymage is column type reflected in your db?

Activity icon

Replied to Laravel Validation Type Depending On Request ?

@atef95 I'll say create custom validation rule and check with file extensions in your custom rule. that'll do the trick for you. For more Read the Docs https://laravel.com/docs/7.x/validation#custom-validation-rules. Cheers!

Activity icon

Replied to Laravel Passport: How To Revoke And Delete Refresh Token?

@devondahon are you sure you wanna delete the refresh token too?

Activity icon

Replied to Update Enum Options In Postgres

@untymage do you have data in the database? or brand new project

Activity icon

Replied to Options For Routing To Visitors, Dashbaord And Admin

@leecolarelli you can do like this write a user_role check in RedirectIfAuthenticated.php file and based on user_role you can redirect. Cheers!

Activity icon

Replied to Format Collection

@msslgomez

$answers = collect($question['answerPager']->groupBy('answer'))->toArray();

after you can write foreach loop for looping

Activity icon

Replied to Update Enum Options In Postgres

@untymage FYI in Postgres After won't work.

Activity icon

Replied to Maatwebsite/excel Create Columns Dynamically Depending On Data

@msslgomez I ran into the same scenario in my project. I ended up creating a custom view where you can customize the excel. so create a view and send data from the controller to view file and customize it in blade view. Cheers

Jul
06
4 days ago
Activity icon

Awarded Best Reply on How To Access {{array}} In Laravel ?

@phoenix5 you can do like this

$mat_aff = array();

for ($i = 0; $i < count(explode(' ', $request->material_code)); $i++) {
                   ...
                    $mat_aff[] =  explode(' ', $request->material_code)[$i];
                }

return view('Mise_a_disposition', ['mat_aff' => $mat_aff] );

and foreach the array in view?

Jul
02
1 week ago
Activity icon

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

@singhwithlaravel it should work

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

also, try after the cache:clear

Activity icon

Replied to Retrieve Old Value Of Select - Using Ajax/javascript - Laravel 7

@ajsmith_codes try like this

<?php

if(old('contact_id')) {
	$old_contact_name = Contact::where('id', old('contact_id'))->first()->name;
}
?>
 //use $old_contact_name in blade file wherever you want
Activity icon

Replied to How To Add Laravel To Existing Angular 9 Design

@jonjie so why don't you create APIs in Laravel and integrate that with Angular? it means you'll ended up having two code repos i.e. one for Laravel and one for Angular. Cheers!

Activity icon

Replied to Retrieve Old Value Of Select - Using Ajax/javascript - Laravel 7

@ajsmith_codes I got the same scenario in my project I ended up using Laravel Sessions save the old value in the session. so you can get in application wherever you want. Cheers!

Jul
01
1 week ago
Activity icon

Replied to How To Access {{array}} In Laravel ?

@phoenix5 you can do like this

$mat_aff = array();

for ($i = 0; $i < count(explode(' ', $request->material_code)); $i++) {
                   ...
                    $mat_aff[] =  explode(' ', $request->material_code)[$i];
                }

return view('Mise_a_disposition', ['mat_aff' => $mat_aff] );

and foreach the array in view?

Activity icon

Replied to Schema::hasColumn Not Working Correctly

@shiva are you using mysql database?

Jun
29
1 week ago
Activity icon

Replied to Column Not Found In Laravel

@nafeeur10 what you are getting for this ??

@php
      $facebook = \DB::table('settings')->select('*')->get();
 @endphp
Jun
28
1 week ago
Activity icon

Replied to Conditional Relationship Loading

@hcphoon01 you can do like this may be?

public function unit()
{
  if ($this->type == 'controller') {
    return $this->belongsTo('App\Models\FMS\'.$this->type, 'unit_id', 'id');
}
Jun
27
1 week ago
Activity icon

Awarded Best Reply on Using Global Variable In Eloquent Model Query

@mecjos try this

public function setPriority ($id) {
        $affectingJob = Job::find($id);
        $machine_id = 1;
        $affectedJobQueue = Job::where([['state_id', 1],['user_id', Auth::user()->parent_user_id]])->with(['order' => function ($query) use ($machine_id) {
            $query->where('machine_id', $machine_id);
        }])->get()->min('queue');

Activity icon

Replied to What To Return On "DELETE" Routes?

@zyberg I'll do like this redirect('/route')->withMessagge('deleted');

Activity icon

Replied to Using Global Variable In Eloquent Model Query

@mecjos try this

public function setPriority ($id) {
        $affectingJob = Job::find($id);
        $machine_id = 1;
        $affectedJobQueue = Job::where([['state_id', 1],['user_id', Auth::user()->parent_user_id]])->with(['order' => function ($query) use ($machine_id) {
            $query->where('machine_id', $machine_id);
        }])->get()->min('queue');