Palak27

Palak27

Member Since 9 Months Ago

Ahmedabad

Developer at Ahmedabad

Experience Points 9,260
Experience Level 2

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 3
Lessons
Completed
Best Reply Awards 14
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.

03 Jun
1 month ago

Palak27 started a new conversation Google Review With Callback Function??

hello everyone,

Does google review api provide any callback function?

I have admin panel with so many employee there. So when any employee send google review link to customer, so i want to track that if that customer sent feedback or not and by which employee that link was sent??

can any one help me ?

21 May
1 month ago

Palak27 left a reply on Is It Possible To Move A Folder To Another Folder With Storage Facade?

@yougotnet yes you can do this like

Storage::move('Folder', 'OtherFolder/Folder');

Palak27 left a reply on Exclude Users If A User Relationship Exists

what issue you are facing while using doesntHave('relation') @

06 May
2 months ago

Palak27 left a reply on How To Only Return Collections Where No Other Relationship

@atmaboy why don't you use whereDoesntHave to check condition. and get only tasks. this is reference link https://laravel.com/docs/5.8/eloquent-relationships

    $query->where('content', 'like', 'foo%');
})->with('task_type')->paginate($tasksPerPage);;```
30 Apr
2 months ago

Palak27 left a reply on I Just Want To Redirect To The Route With Param From Controller Can You Please Help Me ?

So what's the issue in that you can directly do that by usong redirect()->route method instead of return json

return redirect()->route('profile', ['id' => 1]);

26 Apr
2 months ago

Palak27 left a reply on S3 Url Issue In Laravel 5.5

may be something wrong in your configuration here is the link that can help you to configure s3 bucket settings. https://appdividend.com/2018/05/22/laravel-cloud-file-upload-tutorial-with-example

04 Apr
3 months ago

Palak27 left a reply on Using An API Key Alongside JWT Authentication

for api use can generate one random key for each user and store into database when send request you can validate token of particular user.

01 Apr
3 months ago

Palak27 left a reply on Yajra Datatable With Relationship

@fredemagi so you want to display how placed this order and also employee who will process this order.

27 Mar
3 months ago

Palak27 left a reply on Same Tab After Page Refresh

i have implement the same functionality for that when user click on tab i store that tab name into local storage than when ever page refresh i'll check if local storage have some value than show that tab like

$('a[data-toggle="pill"]').on('show.bs.tab', function(e) {
    localStorage.setItem('activeTab', $(e.target).attr('href'));
  });
var activeTab = localStorage.getItem('activeTab');
  if(activeTab){
    $('#myTab a[href="' + activeTab + '"]').tab('show');
  }
12 Mar
4 months ago

Palak27 left a reply on How To Design The Mail Template In Laravel5.5

you can make blade as per your design and send it to mail or you can use mandrill third integration to design own templates

06 Mar
4 months ago

Palak27 left a reply on Git Is Not Tracking My Config/database.php

@viremtechnologies

so your what ever changes you have done so far not reflected in your commit ?

04 Mar
4 months ago

Palak27 left a reply on Laravel Api | Social Networking | Vuejs

@talhaatsix

you can use jwt authentication fo rcustom auth and token multiple devices . here is the link for same https://github.com/tymondesigns/jwt-auth

03 Mar
4 months ago
02 Mar
4 months ago

Palak27 left a reply on Laravel One To Many Relationships Returning Null

@mubeenali in your product controller code push in array like

foreach(\App\product::find($product->id)->images() as $i)
         {
           array_push($arr,$i->image);
         }
01 Mar
4 months ago

Palak27 left a reply on Populate Field Values From Where() Parameter In HasMany() Relation

@v4np3rs13 you can't use BelongsToMany relation here because user hasMany Comments and one Comment belongs to one user only

13 Feb
5 months ago

Palak27 left a reply on Rendering Dynamic Content In Blade

@kshitizmittal

you have to extend layout in bidvw and bidashboard

@extends('layout')

15 Jan
6 months ago

Palak27 left a reply on DB Transaction Rollback Runs There Is Exception

@michaelnguyen547

$result = DB::transaction(function () use($order){
try {
}catch (PaymentException $ex) {
     throw new Exception($ex);
    }
catch (RareException $e) {
    throw new Exception($ex);
}  catch (Throwable $e) {
 throw new Exception($ex);
}

  });
 return $result;
10 Jan
6 months ago

Palak27 left a reply on Method Illuminate\Database\Eloquent\Collection::join

@davy_yg

ApplicationModel::all() returns a collection of Eloquent models. You can't perform a join on that.

If you want to use joins, use the DB facade

Palak27 left a reply on Push To Nested Array

@petritr

 foreach ($Groups as &$Group) {
            foreach ($Group['port'] as &$item) {
                if ( ($item['services']) ) {
                    $item['services']= "name";
                    var_dump($item['services']);
                }
            }
        }
08 Jan
6 months ago

Palak27 left a reply on Get Difference From Object And Array

@petritr

this may help

https://stackoverflow.com/questions/37524969/check-if-an-object-exists-in-an-array

Palak27 left a reply on Send Mail On Model Created

@ahoi

run this command in sequance

php artisan clear-compiled
composer dumpautoload

Palak27 left a reply on Get Difference From Object And Array

@petritr

to check value exists of not you can use in_array() function

https://www.w3resource.com/php/function-reference/in_array.php

Palak27 left a reply on Custom Email Message

@davy_yg below input tag put error message

<input type="email" class="form-control" id="email" name="email" placeholder="[email protected]">

  @if ($errors->has('email'))
     <span class="help-block">
                <strong class="validation-message">{{ $errors->first('email') }}</strong>
         </span>
    @endif
04 Jan
6 months ago

Palak27 left a reply on Image.onload()

@hossamali

instead of Image use FileReader

  $('#new_image').change(function () {
    var reader = new FileReader();
    reader.onload = function (e) {

     
     
    }
    reader.readAsDataURL($(this)[0].files[0]);
  });

Palak27 left a reply on Catching Errors With Stripe?

@gabotronix

try{
             Stripe::setApiKey(config('services.stripe.secret'));

            $customer = Customer::create([
                "email" => $request->input('email'),
                "source" => $request->input('sourceId'),
            ]);

            $user = new User;
            $user->name = $request->input('name');
            $user->password = bcrypt($request->input('password'));
            $user->stripeCustomerId = $customer->id;
            $user->save();

            Auth::login($user);

            return response()->json([
                'message' => 'It worked!',
            ]);

        }
                           catch (\Stripe\Error\ApiConnection $e) {
                                /* Network problem, perhaps try again. */
                                
                                return response()->json([
                'message' => 'Sorry, Network is having trouble. Please try again later.',
            ]);
                              } catch (\Stripe\Error\InvalidRequest $e) {
                                /* You screwed up in your programming. Shouldn't happen! */
                                     return response()->json([
                'message' => 'Sorry. One of our programmer forgot to drink their caffein.',
            ]);
                              } catch (\Stripe\Error\Api $e) {
                                /* Stripe's servers are down! */
                                     return response()->json([
                'message' => 'Sorry our payment processor is down at the moment.',
            ]);
                              } catch (\Stripe\Error\Card $e) {
                                /* Card was declined. */
                                      return response()->json([
                'message' => 'Your card is declined. Please try with a different card.',
            ]);
                              }
03 Jan
6 months ago

Palak27 left a reply on Combine GroupBy And WithCount Query

@faroutchris

you can get data with events like

    $this->with('events')->all()->groupBy('group')
21 Dec
6 months ago

Palak27 left a reply on Convert Custom Query In Laravel

@kshitizmittal

you have to make two Eloquent model one is Employee and second is Reports

in employee model define the relationship with report

if employee has many reports than relationship will be

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

and query will be

Employee::with([    
    punchreports' => function($query) {
          $query->where('date',"2018-12-03)
    }

])->where('status',"Active")->get();

Palak27 left a reply on Mark All Fields Fillable In Model

@pavlen

If you would like to make all attributes mass assignable, you may define the $guarded property as an empty array

according to document

Palak27 left a reply on Redirect With Errors Not Working...

@jpeterson579

use this

$validation = User::validateUpdatePersonalDetails($input,$id)->validate();
18 Dec
6 months ago

Palak27 left a reply on How To Pass The Csrf_token To My View Using Ajax Jquery

@marioeid

istead of {{ csrf_field() }} in form

try this

<input type="hidden" name="_token" value="{{ csrf_token() }}">

Palak27 left a reply on How To Pass The Csrf_token To My View Using Ajax Jquery

@marioeid

you can't pass like this

if you have used post method then make a from like

   $('#posts').append('<li class="arrow_box col-md-10 col-lg-10 offset-lg-1">
<p><span id="title">'+data.data.title+'</span><br/>
<span id="body">'+data.data.body+'</span><br/>
<div class="info">
    <p> 
        <div id="funform"> 
            <div>'+data.data.created_at+'</div>
         <from action = "/deletepost/'+data.data.id" method="post"> 
               {{ csrf_field() }}
            <a  class="fa fa-trash post_delete"></a>
         </from>
            <a class="fa fa-thumbs-up post_like"></a>   
            <a class="fa fa-comment post_comment"></a> 
            <a class="fa fa-edit post_edit" </a></a> 
         </div> 
    </p>  
</div>
</p>
</li>');

Palak27 left a reply on Adding Ajax Url For Pagination

@shawdow instead of redirect you can return view paginate method automatic handle page

f($flag === "ajax"){

            return view('product', compact('pro_category'))->render();

        }else{

            return view('product')->with(['cat'=>$pro_category]);

        }

Palak27 left a reply on How To Pass The Csrf_token To My View Using Ajax Jquery

@marioeid In your data you can pass csrf_token like this

"data": { _token: "{{csrf_token()}}" ,  postform : $(".postform").serialize()},

Palak27 left a reply on A Nested Query

@ehabafia try this

$products = Category::with(['product '=> function($query)  {
      $query->byUser(auth()->id());
    }
 ])

Palak27 left a reply on How To Use WhereHas Inside Of Where?

@jonjie

no need to use return

    $targets = CustomerTargetsItem::where('delivery_date', '=', date_format(Carbon::today(), 'm/d/Y'))
        ->whereHas('customerTarget', function($query){
             $query->where('category_slug', 'scheduled_delivery_of_repaired_t12_48x48_and_euro');
        })
        ->where(function($query){
             $query->whereHas('replacement', function($query){
                     $query->where('status', 3)
                    ->whereDate('created_at', '=', Carbon::today());
                })
                ->orWhereHas('transfer', function($query){
                     $query->where('status', 3)
                        ->whereDate('created_at', '=', Carbon::today());
                });
        })
        ->groupBy('customer_id')
        ->orderBy('delivery_date', 'asc')
        ->select(['customer_id', DB::raw('sum(quantity) AS total')])
        ->get();
10 Dec
7 months ago

Palak27 left a reply on HTML5 Validation Multiple Forms

@petritr

in will start validating in a sequence as you have given in your template

Palak27 left a reply on HTML5 Validation Multiple Forms

@petritr if you use # it will consider it as id and you have given name to from and button so try this

if ($("form[name='save_device']").length > 0 ) {
        if (!$("form[name='save_device']")[0].checkValidity() ) {
            $("form[name='save_device']").each(function(){
                $(this).find("button[name="submit-new-hidden"]").click();
            });
        }
    }

Palak27 left a reply on After Login User, Redirect To Specific Path

@sanjayacloud

override authenticated method in your LoginController like this

public function authenticated(Request $request, $user)
  {
if(Auth::user()->role->name=='admin){
    return redirect('/Dashboard');
}else{

}
    
}
07 Dec
7 months ago

Palak27 left a reply on Laravel Send Sms Using Twilio

@modestasv

twilio sms api throw exception when wrong 'To phone number' given but anyway i handle that exception using try and catch

06 Dec
7 months ago

Palak27 left a reply on Usage Of Php Artisan?

@munazzil

To enable maintenance mode, execute the down Artisan command:

php artisan down

To disable maintenance mode, use the up command:

php artisan up

according to this https://laravel.com/docs/5.7/configuration

Palak27 started a new conversation Laravel Send Sms Using Twilio

hello, folks anyone used twilio for sms ??

Palak27 left a reply on Laravel Query

@nishant_nayan thanks for appreciation

Palak27 left a reply on Laravel Query

@nishant_nayan

i have used using model eloquent this if this can halp you or you want raw query?


$collection = Orders::join('order_lines', 'order_lines.order_id', '=', 'orders.id')
                                            ->join('products', 'products.id', '=', 'order_lines.product_id')
                                            ->select('products.name', DB::raw('sum(order_lines.quantity) AS Total'))
                                            ->where('orders.user_id', $id)
                                            ->where('orders.created_at', '>=', $newdate)
                                            ->groupBy('order_lines.product_id')
                                            ->orderBy('Total', 'DESC')
                                            ->take(7)
                                            ->get()->toArray();