saurabhd

Member Since 2 Years Ago

Ahmedabad

Laravel Developer at Individual Contributor

Experience Points 30,550
Experience Level 7

4,450 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 78
Lessons
Completed
Best Reply Awards 32
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.

21 Feb
1 day ago

saurabhd left a reply on One To Many - First Results And Foreach For Subobjects

@greeenone : Ohh sorry

just put directly your below code without foreach in your view file like:

     {{$folder->name}}

Note : name field use just for example

saurabhd left a reply on One To Many - First Results And Foreach For Subobjects

@greeenone : {{$property->name}} this name use for example so please put your original field name and try

saurabhd left a reply on One To Many - First Results And Foreach For Subobjects

You should try this:

In your controller

$folder = ManagementFolders::where('reference', $reference)->first();

In your view file

@foreach($folder as $property)

     {{$property->name}}
@endforeach  

saurabhd left a reply on Use POST Request For Update Routes

You should try this:

POST

HTTP.POST can be used when the client is sending data to the server and the server will decide the URI for the newly created resource. The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line.

PUT

HTTP.PUT can be used when the client is sending data to the server and the client is determining the URI for the newly created resource. The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI.

PATCH

HTTP.PATCH can be used when the client is sending one or more changes to be applied by the server. The PATCH method requests that a set of changes described in the request entity be applied to the resource identified by the Request-URI. The set of changes is represented in a format called a patch document.

20 Feb
2 days ago

saurabhd left a reply on How To Use Json Encode On Following Data

You should try this:

$arrResult = array (
    [_method] => PATCH,
    [_token] => pp7bjIqWRL8hatrNyh4ZPtNeb8i6lpjD51QCzFMw,
    [permission] => Array
        (
            [Admission] => Array
                (
                    [listing] => on,
                    [Edit] => on,
                    [Delete] => on,
                    [Add] => on,
                    [Print] => on,
                    [Pdf] => on
                ),

            [Announcement] => Array
                (
                    [listing] => on,
                    [Edit] => on,
                    [Delete] => on,
                    [Add] => on,
                    [Print] => on,
                    [Pdf] => on,
                ),

            [Blogs] => Array
                (
                    [listing] => on,
                    [Edit] => on,
                    [Delete] => on,
                    [Add] => on,
                    [Print] => on,
                    [Pdf] => on
                )
      )
);
14 Feb
1 week ago

saurabhd left a reply on How I Search Data From Multiple Colunm In Database Using Array

Your query like:

$admission = Admission::where('name','like','%'.$search.'%')
                                           ->orWhere('city','like','%'.$search.'%')
                                          ->orWhere('present_school','like','%'.$search.'%')
                                             ->paginate($records);

saurabhd left a reply on "The File "/public/plots/20180807_10.56.01_raster11x21_1549956869_FGD.png" Does Not Exist"

Your function like this:

public function download($id){
        $graph=graph::find($id); 
        $file_path = public_path().'/plots/'.$graph->DateiName;
         return response()->download($file_path );
}

saurabhd left a reply on How To Search Data From More Then One Field In Laravel

You should try this:

public function index(Request $request)
    {
        $search = \Request::get('search');
        
        $records = config('constant.displayPageRecords');
        $admission = Admission::where('name','like','%'.$search.'%')->orWhere('address','like','%'.$search.'%')->orWhere('phone','like','%'.$search.'%')->paginate($records);
        return view('admin.admission.index',['admission'=>$admission,'records'=>$records]);
    }

saurabhd left a reply on How To Use Constant Value In Laravel Controller

You should try this:

Please add use Config; in your controller and please check

13 Feb
1 week ago

saurabhd left a reply on Get Number Of Week Day In Carbon

You should try this:

use Carbon\Carbon;

$dayOfTheWeek = Carbon::now()->dayOfWeek;

saurabhd left a reply on Mysql Connection Problems

You should try this:

please update .env file for database configuration

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=dbname
DB_USERNAME=dbuser
DB_PASSWORD=dbpass

saurabhd left a reply on Return Back To A Specific Html Element.

You should try this like:

return redirect()->route('forum.category.thread','#element');

saurabhd left a reply on Is This The Right Way Of Editing A Form?

Update your form like:

<form action="{{ route('posts/',$posts->id) }}" method="POST">
        {!! csrf_field() !!}
    
      <div class="form-group">
          <label for="exampleInputEmail1">Title</label>
          
          <input type="text" class="form-control" name="title" placeholder="Enter title" value="{{ $posts->title }}">
      </div>
      <div class="form-group">
          <label for="exampleTextarea">Body</label>
          <textarea class="form-control" name="body" rows="3">{{ $posts->body }}</textarea>
        </div>
        <div class="form-group">
          
          <input type="submit" class="btn btn-success btn pull-right" value="update">
        </div>

      </form>

saurabhd left a reply on Call To Undefined Method Barryvdh\Debugbar\Facade::isDeferred()

You should try this:

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php

Barryvdh\Debugbar\ServiceProvider::class,

If you want to use the facade to log messages, add this to your facades in app.php:

'Debugbar' => Barryvdh\Debugbar\Facade::class,

12 Feb
1 week ago

saurabhd left a reply on Too Few Arguments To Function App?Http?Controllers?PostController::DateiAusGnu(), 0 Passed And Exactly 1 Expected

@phil1992 : Because you have already define route for DateiAusGnu function so it's give you error

saurabhd left a reply on How To Get Id In Hidden Field From Slug In Laravel?

You should try this:

https://www.simbaa.com/parent/schools/add/reviews?school_id=27296

 <input type="text" name="id" value="{{ app('request')->input('school_id') }}" style="display:none;">

saurabhd left a reply on How To Get Id In Hidden Field From Slug In Laravel?

You should try this:

 <input type="text" name="id" value="27296" style="display:none;">

saurabhd left a reply on Route [userlogin.login] Not Defined

Please display your route.

This is not your route ((View: D:\xampp\htdocs\ticketingsystem.com\resources\views\userlogin\index.blade.php))

11 Feb
1 week ago

saurabhd left a reply on Restore Function Return 404 Not Found

You should try this:

Your route like

Route::get('/blog/post/{post}/restore',[
    'uses' => 'Backend\[email protected]',
    'as' => 'post.restore'
]);

Your function like

public function restore($postId)
    {
    Post::withTrashed()->find($postId)->restore();
        alert()->success('post has been restore')->persistent('Ok');
        return redirect('/blog/post?status=trash');
    }

saurabhd left a reply on Laravel 42000 Syntax Error Or Access Voilation 1064 You Have An Error In Sql Syntax

You should try this:

$notification_request = $users->unreadNotifications()->where($data->type,'send_request')->orderBy('created_at','desc')->get();

08 Feb
2 weeks ago

saurabhd left a reply on Defining Eloquent Function Return Type

@kczmr : Yes it is good idea and habit for declaring string

saurabhd left a reply on Defining Eloquent Function Return Type

You should try this:

class User extends Model
{
    public function getFirstNameAttribute($value): string
    {
        $this->attributes['FirstName'] = ucfirst($value);
    }
}

saurabhd left a reply on How To Send Multiple Mail Using My Database In Laravel

Then you may need to pass array of associative arrays. For example pushing multiple recipients into the $to array:

$to = [['email' => '[email protected]', 'name' => 'User One'], 
       ['email' => '[email protected]', 'name' => 'User Two']];

saurabhd left a reply on How To Send Multiple Mail Using My Database In Laravel

@VANDAN - Ok, so you don't want to set users in cc , you want to set in to Right?

saurabhd left a reply on How To Send Multiple Mail Using My Database In Laravel

The setAdress() function in Mailable allow you to give an array as argument :

    ->cc(['[email protected]','[email protected]'])
    ->send(new document());
07 Feb
2 weeks ago

saurabhd left a reply on OAuth2 (Laravel Passport) - How It Works?

Personal Access Client The personal access client is the access tokens that can be generated will allow us to interact with our API with various tools. These access tokens essentially allow you to authenticate with your API without having to go through the whole OAuth2.0 handshake with your own app and can be used in place of a username and password.

Password Client The password client is utilised mainly in trusted applications that authenticate with your system, this client is internal consumption and potentially a mobile app where the user can login and interact with your API. This grant will require a valid username and password every time to receive a bearer token.

To use your refresh_token to refresh your access token, you need to call the oauth/token route with the grant_type of refresh_token.

saurabhd left a reply on SQLSTATE[42000]: Syntax Error Or Access Violation: 1075 Incorrect Table Definition; There Can Be Only One Auto Column And It Must Be Defined As A Key

With my observation, I would say you should remove second condition in working_days column:

To:

```$table->integer('working_days');
30 Jan
3 weeks ago

saurabhd left a reply on Laravel Observer Check If User Is Logged

Add use \Illuminate\Support\Facades\Auth in the Header of the file

if(!Auth::check()){
    //user is guest
}else{
     //user is logged in
}

17 Jan
1 month ago

saurabhd left a reply on Catch NotFoundHttpException

Please see this link

16 Jan
1 month ago

saurabhd left a reply on Validation

Then you can use Regex in like:

'degname'=>'required|regex:/^[a-zA-Z0-9 ,.-]+$/',

saurabhd left a reply on Validation

You should try this:

'degname'=>'required|alpha_dash',

saurabhd left a reply on How Can I Avoid Image Required In Edit Form If Image Exist In Laravel?

You should try this:

public function store(Request $request) { 
       $rule=array( 'name' => 'required',

           'image' => 'required',
                             );
                             
          if(!empty($inputs['id'])){
                 $user = User::findOrFail($inputs['id']);
               if(empty ( $user->image))
                  $rule=array( 
                           'name' => 'required',
                           'image' => 'required',
                             );
              } else {
                 $rule=array( 'name' => 'required' );
            
             }
               
            }else{
                $rule=array(
                            'name' => 'required',
                            'image' => 'required',
                             );
                $user = new User;
            }

    $user_image = $request->file('image');

   if($user_image){
   
        $tmpFilePath = 'uploads/candidates/';

        $hardPath =  str_slug($inputs['name'], '-').'-'.md5(time());
        $img = Image::make($user_image);
        $img->fit(300, 300)->save($tmpFilePath.$hardPath.'-b.jpg');
        $user->image = $tmpFilePath.$hardPath.'-b.jpg';

    }
          $user->name = $inputs['name'];
          $user->save();

    }

saurabhd left a reply on Object Of Class App\DeliveryAddress Could Not Be Converted To Int

You should try this:

public function checkout (Request $request){

             if($shippingCount>0){
                //update shipping address
               $rsltDeliveryAddrses =  DeliveryAddress::where('user_id', $user_id)->get();

               foreach($rsltDeliveryAddrses as$rsltDeliveryAddrs){
                 DeliveryAddress::where('id', $rsltDeliveryAddrs->id)->update([
                    'name'=>$data['shipping_name'],
                    'address'=>$data['shipping_address'],
                    'city'=>$data['shipping_city'],
                    'state'=>$data['shipping_state'],
                    'pincode'=>$data['shipping_pincode'],
                    'country'=>$data['shipping_country'],
                    'mobile'=>$data['shipping_mobile']
                 ]);
               }
             }
07 Jan
1 month ago

saurabhd left a reply on Validation

You should try this

Your view file

<input name="zipcode" type="text" class="form-control" pattern="[0-9]*" placeholder="" required pattern=".{5,}" title="Must be enter 5 digit" maxlength="5" minlength="5">

Validation file

'zipcode'       => 'required|min:5|max:5',

saurabhd left a reply on Redirect Not Working 100%

You should try this:

return redirect()->route('products.index'');

or

return Redirect::to('/admin/products');
04 Jan
1 month ago

saurabhd left a reply on Undefined Offset Exception When Accessing A Model's Attribute

You should use below way to fix this error.

Using count

if(count($option->price)) { /* do something */ }

if $blogs = [] or $blogs = null the function count will return zero so that means that $blogs is empty.

Using empty

if(!empty($option->price)) { /* do something */ }

saurabhd left a reply on Datatable In Laravel

@komalbhatt : Please display your code and you mean you need on edit column where you edit your record

27 Dec
1 month ago

saurabhd left a reply on Laravel Pagination Causes MethodNotAllowedHttpException ?

You should try this:

Yes pagination only works with get parameters.

You should use GET method for your search page. POST requests aren't meant for the purpose of displaying data. Why? There are many reasons, but to be short I will give you two examples:

With GET parameters, let's say you are on sixth page - you can copy the link and paste it to friend and he will be able to view the same content as you. With POST this is impossible.

You can not use back button with POST requests, if you manage to get pagination to work.

POST requests are useful when you need to submit data to the server, in order to create new record, for example.

So I suggest you to change your route type to GET and your search form method to GET.

saurabhd left a reply on Post Value Through Radio Button But Failed

You should try this:

<input type="radio" name="b2b_buy_sell" id="b2bCashInCashOut1" value="1"/>test
<input type="radio" name="b2b_buy_sell" id="b2bCashInCashOut1" value="2"/>test1

In controller:


public function store(Request $request) {
      $rdioRslt =  $request->b2b_buy_sell;
      return $rdioRslt;

}

saurabhd left a reply on How To Limit Records Per Key Value In Sql

You should try:

 $model = Model::distinct('id')->take(7)->get();

saurabhd left a reply on Hide Flash Message

You should try this:


<head>

<!-- bootstrap -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js">                                                                                  </script>

</head> 

...

<!-- @include('includes.flash')  -->

...

<script>

    $(document).ready(function(){
          $(".alert").delay(5000).slideUp(300);
    });

    </script>
26 Dec
1 month ago

saurabhd left a reply on How To Make Or Set A User Details As A Auth::User() Details In Manually...

You should try this:


if(!Auth::check()){
            $dummyUser = User::where('email','[email protected]')->first();
            if(!$dummyUser){
                $dummyUser = new User();
                $dummyUser -> name = "dummy";
                $dummyUser -> email = "[email protected]";
                $dummyUser -> password = bcrypt("dummy");
                $dummyUser -> save();
            }

            if(Auth::attempt(['email'=>$dummyUser->email,'password'=>'dummy'])){
                dd('Auth User');
            }else{
                dd('Credential mismatch');
            }

            $authUser = $dummyUser;
        }