adityar15

adityar15

Member Since 5 Months Ago

Experience Points
590
Total
Experience

4,410 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 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
590 XP
Jun
30
1 week 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
1 month 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 :(

May
19
1 month ago
Activity icon

Replied to Changing .env File

Hi, so I made changes to the config dynamically. It worked like a charm. Thanks

May
10
2 months ago
Activity icon

Replied to Multi Threading In Laravel

So after lot of research, I finally decided to optimise the code by performing most time-consuming operations like querying data from the database in one transaction and then performing calculations with an optimised algorithm. I am getting the results in around 10 seconds.

Activity icon

Replied to Changing .env File

@drewdan I see. Thanks for the answer. I will try it out :)

Activity icon

Replied to Changing .env File

Thanks for the answer @drewdan. Would this be user-specific? Because I assume that config file is common for the project and so for all the users.

Activity icon

Started a new Conversation Changing .env File

If I change variables in .env file based on the user's action through the controller, then will it change the value for every user?

For instance, suppose if I am changing the SESSION_LIFETIME value based on if a particular user asks to remember, will it change the value for each and every user?

May
07
2 months ago
Activity icon

Replied to {"message":"Unauthenticated."} For Sanctum

The issue is sorted. It's super weird, I just have to restart my laptop to make it work.

Activity icon

Replied to {"message":"Unauthenticated."} For Sanctum

Hello Dom,

Thanks for the reply. I have created the token once using this

$token = $user->createToken('Token Name');

Then I used this token in the code below:


 $url = env('api_url').'/profile';
    $ch = curl_init();
    $post = json_encode(['id'=>auth()->user()->id]);
    
    $header = [
                "Content-Type:application/json",
                'Accept:application/json',
                "Authorization:Bearer 1|LwzPFEJo5EsyGc1ttHapW7nkHE81nU1eOOSaJHyKf6eWKmuHFqdvXANNtXmHYYICPxERA3nlr73U0Fx5",
                "Cache-Control:no-cache",
                'Content-Length: ' . strlen($post)
            ];
               
   
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);    
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS,$post);
    //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

$server_output = curl_exec($ch);
$err = curl_error($ch);
curl_close ($ch);
if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    return $server_output;
  }


And in the same project in the API controller

public function profile(Request $request){
    $id = $request->id;
    $uset= \DB::table('user')->where('user_id',$id)->first();
    return response()->json([
        'profile'=>$user,
    ]);
}
May
06
2 months ago
Activity icon

Started a new Conversation {"message":"Unauthenticated."} For Sanctum

Hi, I am developing Laravel API and using Sanctum for authenticating the token. I plan to use this API for my Laravel web app and mobile app in the future. It is not a SPA and I am calling this API at the back end. Why do I get {"message":"Unauthenticated."} even after setting SANCTUM_STATEFUL_DOMAINS in .env? I followed the documentation as it is.

May
05
2 months ago
Activity icon

Replied to BotMan In Laravel 7 - Does It Work?

I tried it and I am also getting the same error. When I checked on github botman's repository it shows that they have opened the thread for Laravel 7 support but seems like it's still in development :(

Apr
28
2 months ago
Activity icon

Replied to Multi Threading In Laravel

I see. Thanks @rodrigo.pedra for a detailed explanation. Very much appreciated. So, its to have a table where results are stored after the job is processed and once the results are ready to collect from the table, fetch them and display to the user or use it for further processing if required. I will give it a try. I was more looking like Python's threading module equivalent for PHP. And seems like pthread of PHP is not made for web servers. So the options either are queuing the jobs or synchronous code with code optimisation.

Activity icon

Replied to Multi Threading In Laravel

I have used queues before. But I don’t know how to receive the output of the queue as I will require to fetch the output to display it to the user on front end. If I am right, queues run in the background and are good for tasks where you do not require a return value eg sending emails, updating database etc.

Apr
27
2 months ago
Activity icon

Started a new Conversation Multi Threading In Laravel

So I have a function in Controller which will be doing heavy computations. I am trying to achieve concurrent programming to get this task done by multiple threads. I tried researching on symphony process but its mostly for artisan commands. How can I achieve using multithreading to split and do the task in a controller function between multiple threads?

Mar
09
4 months ago
Activity icon

Replied to Dusterio Aws-sqs-worker Error 500.

Finally, I was able to find a solution. For those who might face the same problem in the future or who are looking for the solution. I configured the supervisor by doing ssh in the EC2 server using the following link

https://gist.github.com/vrajroham/6565c4b2e9b4db693c1524394545a610

The package I was using seems still need some improvement for Laravel 7. That's why the worker environment was throwing an error. Unfortunately I was not able to trace down the exact error but suffice to say it was 500

After using supervisor on the web environment, it works like charm.

Mar
06
4 months ago
Activity icon

Started a new Conversation Dusterio Aws-sqs-worker Error 500.

I am using Laravel 7.0 and dusterio package for sqs. I have deployed the project successfully on AWS worker env. Whenever a job is pushed to SQS, its always on flight. I tried testing the same job with php artisan queue:work and things are fine. But whenever my worker environment tries to access the job from sqs, the message goes in flight. I checked the logs and I am getting following error

2020-03-07T01:27:06Z start: polling https://sqs.eu-west-2.amazonaws.com/382144530985/quetest
2020-03-07T01:27:08Z message: sent to http://localhost:80/worker/queue
2020-03-07T01:27:08Z http-err: 98e28b69-fd41-4db9-b0e8-9f0da34073c7 (1) 500 - 0.246
2020-03-07T01:29:53Z message: sent to http://localhost:80/worker/queue
2020-03-07T01:29:53Z http-err: 15ee85f0-df6f-4127-829d-de6ec11e3c9b (1) 500 - 0.020
2020-03-07T01:32:08Z message: sent to http://localhost:80/worker/queue
2020-03-07T01:32:08Z http-err: 98e28b69-fd41-4db9-b0e8-9f0da34073c7 (2) 500 - 0.019
2020-03-07T01:34:53Z message: sent to http://localhost:80/worker/queue
2020-03-07T01:34:53Z http-err: 15ee85f0-df6f-4127-829d-de6ec11e3c9b (2) 500 - 0.015
2020-03-07T01:35:50Z message: sent to http://localhost:80/worker/queue
2020-03-07T01:35:50Z http-err: 34c64fbc-dcf3-4a65-85d0-99961ca5e30d (1) 500 - 0.016

Can anyone please help me to sort this out?

Thanks :)

Mar
04
4 months ago
Activity icon

Replied to Will There Be An Update For Laravel 7 Shopping Cart Package?

Thanks for the comments. I will keep checking on it.

Activity icon

Started a new Conversation Will There Be An Update For Laravel 7 Shopping Cart Package?

Will there be an update for the Bumbummen99 Shopping Cart package for Laravel 7? I am not able to upgrade from Laravel 6.18.0 to Laravel 7.0.4 because bumbummen package is not supported in Laravel 7.

Jan
29
5 months ago
Activity icon

Replied to How Can I Enable Push Notifications For Safari On IOS?

@sti3bas thanks for the reply. I will check on it.

Jan
28
5 months ago
Activity icon

Started a new Conversation How Can I Enable Push Notifications For Safari On IOS?

I have a Laravel website and I have enabled push notifications using Pusher and Laravel's Notification trait. I have no issues on android and desktop. The problem is with safari on iOS. How can I send push notifications to iOS devices? I tried getting the certificate from apple developer's account but there is no certificate section on my developer's account.

Jan
23
5 months ago
Activity icon

Replied to How Do I Sum Every N Rows In Laravel Using MySQL Queries?

Thanks for the comment. I have edited my question. I tried the chunk method before but it didn’t work.

Activity icon

Started a new Conversation How Do I Sum Every N Rows In Laravel Using MySQL Queries?

I have a data set like this:


id | column1| column2| column3
1  | ABCDE   | 100          | 300
2  | ABCDE   | 100          | 100
3  | ABCDE   | 200          | 100
4  | PQRST   | 300          | 300
5  | PQRST   | 300          | 500
6  | PQRST   | 300          | 300
7  | PQRST   | 300          | 400
8  | PQRST   | 400          | 100
8  | PQRST   | 500          | 200


Suppose N is 3 then I want as a result something like:


id | column1| column2  | column3
1  | ABCDE   | 400           | 500
2  | PQRST   | 900            | 1100
3  | PQRST   | 1200          | 700


How can I achieve this?

I have array where $set = ['ABCDE', 'PQRST']

My query so far


$query =  \DB::table('table_name');
  foreach($set as $item){
    $query->orWhere('column1',$item);
  }


Thanks in advance :)