Our Black Friday sale is now live! All individual subscriptions are 50% OFF. This week only!

adityar15

adityar15

Member Since 10 Months Ago

Experience Points
1,560
Total
Experience

3,440 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
1
Lessons
Completed
Best Reply Awards
0
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 1
1,560 XP
Nov
19
5 days ago
Activity icon

Replied to Join For Multiple Foreign Keys Pointing To Same Primary Key

Perfect. This worked like charm. Thanks @michaloravec

Nov
17
1 week ago
Activity icon

Started a new Conversation Join For Multiple Foreign Keys Pointing To Same Primary Key

In my users table, I have a list of registered users and each user has different roles. For instance User A, B and C have role of X, Y and Z.

In another table, table Work, I am storing the id of these users. This id is a primary key in users table.

So my table Work has something like this


Workid | X_id | Y_id | Z_id
1            | 1      | 3      |  2

My Users table is something like this

id | Name      | Role
1  | Person 1 | X
2  | Person 2 | Z
3  | Person 3 | Y

What I am trying to achieve is on the front end I want to display in tabular format details of Work table which will have columns as

Workid, X name, Y name and Z name.

I am using DB Query builder and I tried join. It gives as I cannot use multiple separate joins with the same table.

How can I achieve the end result?

Thanks in advance :)

Nov
12
1 week ago
Activity icon

Replied to Redirecting A Subdomain To A Specific Url

@marianomoreyra I tried it but it did not work. I am getting error 500 and a message that there is a mistake in the configuration.

Nov
11
1 week ago
Activity icon

Replied to Redirecting A Subdomain To A Specific Url

Thanks for the answer @marianomoreyra I will try this out.

Activity icon

Started a new Conversation Redirecting A Subdomain To A Specific Url

I have a Laravel project on Elastic BeanStalk at domain https://www.example.com. Now I want to redirect a subdomain https://store.example.com to https://www.example.com/store but however, the URL in the browser would be https://store.example.com

Is it possible to do so? How can I achieve it? Thanks in advance :)

Nov
09
2 weeks ago
Activity icon

Replied to Laravel RESTful Shopping Cart

@filipkrstic I struggling with the same problem. Did you find a solution for yours?

Oct
28
3 weeks ago
Activity icon

Started a new Conversation How To Build White Label Laravel Application For The Existing One?

So I have a Laravel web app which is under our brand (logo, information on pages, etc.). We are planning to white label it a part of the web app. What would be the best way to do it?

I thought of having API endpoints developed in the main app and the white-labelled products talk with the main app using API. In this case, the issue would be with managing the cors.

Thanks :)

Oct
20
1 month ago
Activity icon

Replied to Livewire Not Making Any Ajax Requests?

Thanks @snapey. It worked for me. Just need to add a single parent element in one component. Forgot that every component of live wire is similar to Vue component where Vue has a template and here in Livewire it is one parent div or element.

Thanks again for the help :)

Activity icon

Replied to Livewire Not Making Any Ajax Requests?

I have the same problem for select wire:change. Did you find the solution to your problem @ollie_123

Oct
14
1 month ago
Activity icon

Replied to LinkenIn Login Using Socialite

@thewebartisan7 Thnks for the answer. I am an approved developer. I am trying to use r_basicprofile. Whenever I put scope a r_basicprofile, I receive an error code not found.

Activity icon

Started a new Conversation LinkenIn Login Using Socialite

I am using Socialite 5.* package for LinkedIn login. I want to get the vanity name of the user but as r_basicprofile is not supported, how can I get the vanity name?

Sep
11
2 months ago
Activity icon

Started a new Conversation Secure Way Of Storing User Data On Client Side For Further Requests - Sanctum

I have an API in Laravel using Sanctum for SPA. I am trying to figure out how can I store user data after login request on the client-side for further requests to serve.

Should it be in Cookies? Should it be in local storage?

Sep
09
2 months ago
Activity icon

Replied to Illuminate\Contracts\Container\BindingResolutionException Target Class [UserController] Does Not Exist.

@sergiu17 Thanks for the response. Seems like the Laravel 8.x update has a different way of using routes.

Previously it was

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

Now it has changed to

use App\Http\Controllers\TestController;
Route::get('test',[TestController::class, 'test']);

To do it the old style you need to add $namespace property in RouteServiceProvider.

Not sure why they made it bit complicated :)

Sep
01
2 months ago
Activity icon

Started a new Conversation How To Compare 2 Pdfs In Laravel?

So I have a feature in my web app to stream the pdf in the browser. It is actually an HTML template converted to pdf using barryvdh/laravel-dompdf package.

What I am trying to achieve is a way to compare this pdf with the one uploaded by the user to check if they are same. How can I achieve this?

Aug
30
2 months ago
Activity icon

Started a new Conversation Supervisor On AWS Elastic Beanstalk Stopped Working All Of A Sudden.

I have my Laravel application deployed on AWS EBS. I have configured the supervisor using this link https://gist.github.com/vrajroham/6565c4b2e9b4db693c1524394545a610

It works pretty well for the first few days and then it stops working automatically. I checked the files for a supervisor but they are deleted. This has happened 3 times. What might be the reason/s for this?

Aug
26
2 months ago
Activity icon

Replied to 419 Error For Sanctum API Post Request.

Yeah you are right. The token is getting expired. I checked in the network tab in the debugger of chrome and it shows 419 session expired in preview. Is there any way I can pass the XSRF Token without it getting expired?

Aug
25
2 months ago
Activity icon

Replied to 419 Error For Sanctum API Post Request.

@maverickchan I am not using Vue nor axios. I am using Jquery and vanilla JS

Activity icon

Replied to 419 Error For Sanctum API Post Request.

Hello @maverickchan Thanks for the reply. I edited the authorisation token. I am not taking it from env. I am still facing the same problem of unknown status 419. I guess it has to do with XSRF-TOKEN. The keys in the header do require quotes else it throws an error.

Activity icon

Started a new Conversation 419 Error For Sanctum API Post Request.

My cors.php looks like this

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Laravel CORS Options
    |--------------------------------------------------------------------------
    |
    | The allowed_methods and allowed_headers options are case-insensitive.
    |
    | You don't need to provide both allowed_origins and allowed_origins_patterns.
    | If one of the strings passed matches, it is considered a valid origin.
    |
    | If array('*') is provided to allowed_methods, allowed_origins or allowed_headers
    | all methods / origins / headers are allowed.
    |
    */

    /*
     * You can enable CORS for 1 or multiple paths.
     * Example: ['api/*']
     */
    'paths' => ['api/*','sanctum/csrf-cookie'],

    /*
    * Matches the request method. `[*]` allows all methods.
    */
    'allowed_methods' => ['*'],

    /*
     * Matches the request origin. `[*]` allows all origins.
     */
    'allowed_origins' => ['*'],

    /*
     * Matches the request origin with, similar to `Request::is()`
     */
    'allowed_origins_patterns' => [],

    /*
     * Sets the Access-Control-Allow-Headers response header. `[*]` allows all headers.
     */
    'allowed_headers' => ['*'],

    /*
     * Sets the Access-Control-Expose-Headers response header with these headers.
     */
    'exposed_headers' => [],

    /*
     * Sets the Access-Control-Max-Age response header when > 0.
     */
    'max_age' => 0,

    /*
     * Sets the Access-Control-Allow-Credentials header.
     */
    'supports_credentials' => true,
];

My ajax get request works perfectly fine. The problem is with AJAX POST request. I am constantly getting 419 error. I have included X-XSRF-TOKEN header in my ajax headers. On document ready, I am firing a function which looks like this

  fetch('/sanctum/csrf-cookie')
  .then(response => console.log(response))
  .then(data => console.log(data));

This function creates XSRF-TOKEN cookie which I am using in my ajax header as

t = gettoken('XSRF-TOKEN');
$.ajaxSetup({
  headers: {
    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content'),
    'X-XSRF-TOKEN': t,
    'Authorization': "Bearer {{env('bearer_token')}}"
  },
  async:false
});

The get token function is nothing but cookie retrieving function. Even after all of this, I am getting 419 error. What could be the reason? Any solution? Thanks in advance :)

Jul
21
4 months ago
Activity icon

Replied to Do Changes In Config File By One User, Reflects For All Users?

I am creating a different connection. One will be for me and others for the users.

Activity icon

Started a new Conversation Do Changes In Config File By One User, Reflects For All Users?

I am working on a project for creating a CRUD application for users where they can navigate to the link put their DB configurations and perform CRUD operation. Obviously I need to change the DB configurations on fly and for each user to would be separate.

So if a user updates DB configurations in the config file in Laravel with Config::set(), would it affect every user or only that particular user considering that every user updates their configuration at same end point?

Jul
17
4 months ago
Activity icon

Started a new Conversation Joining Table Based On List Of Array In The Join Table Column

I am trying to solve something complicated problem which might be straightforward. So I am trying to join 4 tables. The 4th table has a column named subids which has list of ids and these ids are in the same table in the column id.

So here is the example:

Table A:

IDA | COLA | COLB |
1     ABC   CDE 
2     STR   YUA

Table B:

IDB | IDA| COLE |
1     1   YXA
2     3   ABS

Table C:

IDC | IDB| COLF |
1     1   QRT
2     4   IUQ

Table D:

IDD | IDC | COLH |
1     1   URT,OPQ
2     URT
3     NPQ   

So in Table D's COLH there is URT,OPQ as string so they need to be converted to an array before proceeding if required. Now URT is present in COLH of Table D so I want values related with URT from Table D in the retrieved collection.

How can achieve it in one query (with the query builder) using joins? The example of the collection received from the query will be something like this

{
'IDA': 1,
'IDB': 1,
'IDC': 1,
'IDD': 1
},
{
'IDA': 1,
'IDB': 1,
'IDC': 1,
'IDD': URT
},


Jun
30
4 months ago
Activity icon

Replied to How To Get Started With Vue In Laravel 5.6 Without Npm Or Gulp

Thats what I am looking for. Thanks

Jun
07
5 months ago
Activity icon

Started a new Conversation Laravel Cashier Stripe Key Error In Spite Of Using Correct Key

Hi, I am working on integrating Laravel cashier in my project for a subscription. I am following Laravel docs for this. The procedure is simple, take card details -> create a subscription with 30 days trial. However, I am getting the error that local.ERROR: No such paymentmethod: pm_1GrX9JJBBrYOr00bG1B6PrUj; a similar object exists in test mode, but a live mode key was used to make this request.

I double-checked with the Stripe public test key and its all correct.

Here is my code: Front end:

<div id="card-element" class="cookcardelement"></div>
<div id="card-errors"  role="alert"></div>

<script>
var stripe = Stripe('pk_test_***********ybI4rb3Ur3RK500DRddhuXc'); /*actual chars replaced with * just for this post */
const elements = stripe.elements();
var style = {
  base: {
    color: "#32325d",
    fontFamily: '"Helvetica Neue", Helvetica, sans-serif',
    fontSmoothing: "antialiased",
    fontSize: "16px",
    "::placeholder": {
      color: "#ccc"
    }
  },
  invalid: {
    color: "#fa755a",
    iconColor: "#fa755a"
  }
};

const cardElement = elements.create("card", { style: style, hidePostalCode:true});

    cardElement.mount("#card-element");
    cardElement.on('change', showCardError)
async function createpayment(){
  const {paymentMethod, error} = await stripe.createPaymentMethod({
  type: 'card',
  card: cardElement,
  billing_details: {
    name: $('#fname').val(),
  },
});
if(error){
    alert(error);
}
else{
    return paymentMethod.id;
}
}

function proceed(){
 ...
createpayment().then(function(result) {
        var paymentobj = {'paymentmethod':result};
        var plan = {'plan': $('#plan').val()};
        datatosend = Object.assign(paymentobj,plan);
        sendajax(datatosend);
}
   })
        .catch(function() {
            alert('error');
        });  

</script>

Back end where ajax request is made to

public function subscribe(Request $request){
 $user = User::find(16);
        try {
            $subscription = $user->newSubscription('main', $request->plan)
            ->trialDays(10)
            ->create($request->paymentmethod);
        } catch (IncompletePayment $exception) {
            return redirect()->route(
                'cashier.payment',
                [$exception->payment->id, 'redirect' => route('/')]
            );
        }     
        
       
                    return response()->json([
                        'status_code'=>1,
                        'messages'=>'success'
                    ]);  
}

Don't know what's the reason for getting the error :(