Palak27

Palak27

Member Since 7 Months Ago

Ahmedabad

Developer at Ahmedabad

Experience Points 9,140
Experience Level 2

860 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 Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

06 May
1 week 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 weeks 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
3 weeks 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
1 month 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
1 month 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
1 month 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
2 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
2 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
2 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
2 months ago
02 Mar
2 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
2 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
3 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
4 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
4 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
4 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
4 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
4 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
4 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
5 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
5 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
5 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
5 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();
04 Dec
5 months ago

Palak27 left a reply on Encryption Key Needed

@martin182 first check APP_KEY in your .env

run below command : php artisan config:cache