Prathamesh6921

Prathamesh6921

Member Since 10 Months Ago

Experience Points
260
Total
Experience

4,740 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
0
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
260 XP
20 Dec
9 months ago

Prathamesh6921 started a new conversation Unable To Store Files In The Databse

Not getting any error while uploading the file in the database

I am trying to store multiple files in the database in laravel but not getting any error, I also check with the dd in the backend but got nothing. I don't know how check. Can anyone help me how how to fix this?

The path in which I'm storing the diploma files is used to store another files so I am using same folder(storage/app/license) and I have created a folder under app (diploma) but it is also not working

$diplomaname = $request->get('diplomaname');
$diplomayear = $request->get('diplomayear');
$all_params = $request->keys();
$total_diplomas = preg_grep('/^diplomafile_.*/', $all_params);

if ($diplomaname != null && $diplomayear != null) {
  $dip = new Diplomas();
  $dip->lawyer_id = $lawyer-> id;
  $dip->diploma_institution = $diplomaname;
  $dip->year = $diplomayear;
  $dip->save();
}
for ($j = 0; $j < count($total_diplomas); $j++) {
  if ($request->get('diplomafile_'.$j) != null) {
    $filename = $request-> file('diplomafile_'.$j)->store('licenses');
    $dipfile = new Diplomafile();
    $dipfile->lawyer_id = $lawyer->id;
    $dipfile->file = $filename;
    $dipfile->save();
  }
}

ia hve created separate table to store files as they are multiple ,please help with this i am on this since last 2 days, i am not even getting any error,earlier i was gettting error 'call to member function store null' but as made changes in my frontend jquery & ajax code so that error is not coming and also done severals dd() but got nothing

18 Dec
9 months ago

Prathamesh6921 started a new conversation Display Data Based On User Role

Greetings, i am novice in laravel ,I am trying to fetch all the data on admin profile .On the admin page he want to see the requests made by all users. Login function for role check while sign in.

 public function loginProcess(Request $request)
        {
            if(Auth::attempt(['email' => $request->email, 'password' => $request->password, 'status'=>1])){
                if((Auth::user()->role == 'admin')){
                     return url('showallrequest');
                } else {
                    if($request->session()->has('request_cache')){
                        return $this->saveRequest($request);
                    } else {
                        return url('displayLegal');
                    }
                }
                return 'true';
            }
            return "false";
        }

This is the user controller in which admin will logged-in and after login he will be redirected to the dashboard where he will see all the user's requests.

@section('content')
    <div class="row" style="padding-left: 35px;padding-right: 35px;" >
        <div class="col-md-12" style="margin-bottom: 20px">
            <button class="btn btn-success pull-right" style="background: red;border: none;"><a href="submit_query">New Request <i class="fa fa-plus" style="margin-left: 10px;"></i></a></button>
        </div>
        <div class="col-md-12" id="user_request_div">

        </div>
        <!--end .card -->
    </div>
    @endsection
@section('side_bar')
    @include('backend_template.includes.side_bar')
    @endsection

@section('jsses')
    @include('frontend_template.includes.foot')
    <script>
        $.ajax({
            url:"showAllReqToAdmin",
            type:"POST",
            data:{_token:csrf_token},
            success: function (result) {
                $('#user_request_div').html('');
                console.log(result);
                for(var i = 0;i<result.length;i++){
                    if(result[i].service_package.default_price == null){
                        result[i].service_package.default_price = 0;
                    }
                    $("<div class='card'> " +
                        "<div class='card-body text-default-light' style='padding: 15px;' > " +
                            "<div class='row'>" +
                                    "<div class='col-md-2' style='text-align: left' >"+
                                    "<h4>"+result[i].user.firstname+"</h4>"+
                                    "<h5>"+result[i].user.lastname+"</h5>"+
                                    "</div>"+
                                    "<div class='col-md-3' style='text-align: left' >" +
                                        "<h4 style='padding: 0px'>"+result[i].request_type.aop.name+"</h4>" +
                                        "<h5>"+result[i].title+"</h5>" +
                                    "</div>" +
                                    "<div class='col-md-3' style='text-align: center'> " +
                                        "<h4>Resolution method:</h4> " +
                                        "<h5>"+result[i].service_package.title+ " (" + result[i].service_package.default_price + " SGD)" +"</h5> " +
                                    "</div>" +
                                    "<div class='col-md-2' style='text-align: center'>" +
                                        "<h4>Not yet assigned</h4>" +
                                    "</div>" +
                                    "<div class='col-md-2' style='text-align: center'>" +
                                        "<h4>New</h4> " +
                                        "<h5>"+result[i].created_at+"</h5>" +
                                    "</div>" +
                            "</div>" +
                        "</div>" +
                    "</div>").appendTo('#user_request_div');
                }
            }
        });
    </script>
@endsection

In this blade page i have written the code to append the data

Route.php

Route::get('showAllReqToAdmin', '[email protected]');

I am not getting any error,don't know where is the exact probelm with laravel 5.7 i am using jQuery and ajax,please help me

13 Dec
9 months ago

Prathamesh6921 started a new conversation Store 2 Out Of 3 Fields In The Database

Hii all,i am trying to solve the logic ,i want to keep 3 fields(license_institution, licences_number and file) non mandatory in the registration but now as per new requirement 2(license_institution, licences_number) of them user should be able to fill and 3rd(file) field should leave blank. how would i solve it. i am getting the call to member function on store null

if($role == 'legal'){
            $lawyer = new Lawyer();
            $lawyer->user_id = $user->id;
            $lawyer->save();
            if($request->get('licname_0') != null || $request->get('lic_no_0') != null || $request->file('lic_file_0') != null){
                for ($i = 0; $i < count($total_licenses); $i++) {
                    $filename = $request->file('lic_file_' . $i)->store('licenses');
                    $license = new License();
                    $license->lawyer_id = $lawyer->id;
                    $license->file = $filename;
                    $license->licenseno = $request->get('lic_no_' . $i);
                    $license->institution = $request->get('licname_' . $i);
                    $license->save();
                }
            }else if (($request->get('licname_0') != null || $request->get('lic_no_0') != null) && $request->file('lic_file_0') == null){
                for ($i = 0; $i < count($total_licenses); $i++) {
                    $filename = $request->file('lic_file_' . $i)->store('licenses');
                    $license = new License();
                    $license->lawyer_id = $lawyer->id;
                    $license->file = $filename;
                    $license->licenseno = $request->get('lic_no_' . $i);
                    $license->institution = $request->get('licname_' . $i);
                    $license->save();
                }
            }
22 Nov
10 months ago

Prathamesh6921 left a reply on Call To A Member Function Store() On Null

@D9705996 - tx for the reply, i have tried it but i dnt no whats wrong with it

Prathamesh6921 started a new conversation Call To A Member Function Store() On Null

when i am trying to upload an image it gives me an error

view

 Select  Legal Documents: <input type="file" id="imgUpload1" name = "imgUpload1">'''

controller.


'public function registerLawyer(Request $request){
        $firstname = $request->get('firstname');
        $lastname = $request->get('lastname');
        $country = $request->get('country');
        $role = $request->get('role');
        $dob = $request->get('dob');
        $email = $request->get('email');
        $pass = $request->get('password');
        $aop = $request->get('pracitces');
        $file = $request->file('imgUpload1')->store('images');
        $filename = str_replace('public/','',$file);
        $licensenum = $request->get('licenseNumber');
        $license = $request->get('license');
        $user_data = DB::table('users')->insert([
            'firstname' => $firstname,
            'lastname' => $lastname,
            'country' => $country,
            'role' => $role,
            'dob' => $dob,
            'email' => $email,
            'password' => $pass,
        ]);
        $user = DB::table('users')->where(['firstname'=>$firstname])->first();
        $lawyer_data = DB::table('lawyer')->insert([
            'u_id' => $user->id,
            'practices' => $aop
        ]);
        $law = DB::table('lawyer')->where(['u_id'=>$user->id])->first(['id']);
        if(is_array($license && $license != null) && isset($license)){
            $license_data = DB::table('license')->insert([
                'lawyer_id' => $law->id,
                'file'=>$filename,
                'licenseno' => $licensenum,
                'institution' => $license
            ]);
        }
            return redirect('welcome');
    }

Prathamesh6921 started a new conversation Store Data In 3 Tables In

Hi all,i new here and in laravel also,i want to store data in 3 tables using single registration form

class UserController extends Controller { public function registerLawyer(Request $request){ $firstname = $request->get('firstname'); $lastname = $request->get('lastname'); $country = $request->get('country'); $role = $request->get('role'); $dob = $request->get('dob'); $email = $request->get('email'); $pass = $request->get('password'); $aop = $request->get('pracitces'); $licensenum = $request->get('licenseNumber'); $license = $request->get('license');

    $user_data = DB::table('users')->insertGetId([
        'firstname' => $firstname,
        'lastname' => $lastname,
        'country' => $country,
        'role' => $role,
        'dob' => $dob,
        'email' => $email,
        'password' => $pass,
    ]);
    $user = DB::table('users')->where(['firstname'=>$firstname])->first('id');
    $lawyer_data = DB::table('lawyer')->insertGetId([
        'u_id' => $user->id,
        'practices' => $aop
    ]);
    $law = DB::table('lawyer')->where(['u_id'=>$user->id])->get('id');
    $license_data = DB::table('license')->insert([
            'lawyer_id' => $law->id,
            'licenseno' => $licensenum,
            'institution' => $license
        ]);
        return redirect('welcome');
            }

}

('id' is a primary key in user table) "u_id" is foreign key in 'lawyer' table and lawyer_id is a foreign key in license table. While storing the data i am getting error,

Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_RECOVERABLE_ERROR) Argument 1 passed to Illuminate\Database\Grammar::columnize() must be of the type array, string given, called in C:\Users\Syntag\phpProjects\quesmi_web\vendor\laravel\framework\src\Illuminate\Database\Query\Grammars\Grammar.php on line 137

i have written all the code in controller only ,i am not using model or eloquent,is there any way to get this done.