saurabhd

Laravel Developer at Individual Contributor

Hire Me

Experience

18,310

27 Best Reply Awards

  • Member Since 11 Months Ago
  • 0 Lessons Completed
  • 0 Favorites

21st November, 2017

saurabhd left a reply on How To Show Count Of Array In Blade And If Count Equal To 1 Then Show The Value? • 21 hours ago

Please show more code blade file and controller.

17th November, 2017

saurabhd left a reply on Undefined Variable: Forum • 4 days ago

Please check my updated answer

saurabhd left a reply on Gettting Un Defined Variable Error • 4 days ago

Please change you route like because same name route issue so please try this:

Route::get('/categories', function () { return view('categories'); }); 

To

Route::get('catagory/categories', function () { return view('categories'); }); 

saurabhd left a reply on Undefined Variable: Forum • 4 days ago

You should try this:

public function index()
    {
        $forum = Forum::all();
        return view('forum.index',compact('forum'));
    }

OR

public function index()
    {
        $forum = Forum::all();
        return view('forum.index')->with(['forum'=>$forum]);
    }

saurabhd left a reply on Gettting Un Defined Variable Error • 4 days ago

Please put some view code for categories.blade.php and controller function for display categories.blade.php

saurabhd left a reply on NotFoundHttpException In Compiled.php Line 8889 • 4 days ago

Please run below command in terminal/cmd:


php artisan install (if vendor folder not created)
php artisan composer dump-autoload
php artisan config:cache
php artisan config:clear
php artisan cache:clear
php artisan route:clear

Hope this work for you!!!

15th November, 2017

saurabhd left a reply on Radio Button • 6 days ago

You should try with below example:

<input type="radio" name="gateway" value="paypal" <?php if(Input::old('gateway')== "paypal") { echo 'checked="checked"'; } ?> id="paypal" checked class="gateway"> Paypal

saurabhd left a reply on How To Display Name Of Relationships Instead ID On Update? • 6 days ago

Please display AddMember and Activist model.

saurabhd left a reply on SQLSTATE[HY000]: General Error: 1005 Can't Create Table • 6 days ago

Please follow this link

14th November, 2017

saurabhd left a reply on Namespace Vs Use? • 1 week ago

Please follow this link

13th November, 2017

saurabhd left a reply on Select Option Property Not Working • 1 week ago

You should try this:


<select name="notificationtype" required class="form-control">
    <option value="sms" {{($template->type=='sms') ? 'selected="selected' : ''}} > SMS </option>
    <option value="email" {{($template->type=='email') ? 'selected="selected' : ''}}> Email </option> 
</select>



saurabhd left a reply on How To WhereHas When Use BelongsToMany Relation? • 1 week ago

I think you should change your Subject model like

public function User() { return $this->belongsToMany(User::class); }

9th November, 2017

saurabhd left a reply on Blade Syntax Error With Empty String Variable • 1 week ago

Please give output as per below code:

 print('<pre style="color:red;">');
 print_r($data);
 print('</pre>');
 exit;



saurabhd left a reply on Blade Syntax Error With Empty String Variable • 1 week ago

you should try this:


<input class="form-control" type="text" id="nameEng" name="nameEng" value="{{!empty($tagTrans['en']) ? $tagTrans['en'] : ' ' }}" />



8th November, 2017

saurabhd left a reply on Undefined Property: Illuminate\Database\Eloquent\Collection::$fb_enable • 1 week ago

Please show your view file bcard_web where you put fb_enable variable.

saurabhd left a reply on Undefined Property: Illuminate\Database\Eloquent\Collection::$fb_enable • 1 week ago

Please show your settings result like:

public function getBussinesscard()
{
    $domain = $_SERVER['SERVER_NAME'];
    $user = User::where('domain', $domain)->first();

    $settings = Setting::where('user_id', $user->id)->get();

    print('<pre style="color:red;">');
    print_r($settings);
    print('</pre>');
    exit;
    
    return view('soulfy.bcard_web', ['user' => $user, 'settings' => $settings]);
    
    }

saurabhd left a reply on When The Same Attribute Name Is In Other FormRequest. • 1 week ago

Are you use name as label then you should change your lang like:

// in my image...
'attributes' => [
    'nameA' => 'Name in FormRequestA',
    'nameB' => 'Name in FormRequestB'
]


28th October, 2017

saurabhd left a reply on SQLSTATE[23000]: Integrity Constraint Violation: 1048 Column 'postqs_id' Cannot Be Null (SQL: Insert Into `reply_qs` (`reply`, `postqs_id`, `updated_at`, `created_at`) Values (fff, , 2017-10-28 06:03:30, 2017-10-28 06:03:30)) • 3 weeks ago

@sakti You are getting this error as you are not getting value of $request->get('postqs_id').

You will get it only if postqs_id is passed in URL.

So before the query, you need to check, whether $request->get('postqs_id') has some value or not. If you are not getting any value in this, you need to display error message to user.

Thanks

16th October, 2017

saurabhd left a reply on Problems With Nested Relationships • 1 month ago

You can use:

return $this->belongsTo('App\Car', 'car_id', 'id');

instead of

return $this->belongsTo('App\Car', 'car_id');

in your Rate model relationship

saurabhd left a reply on Stripe • 1 month ago

You want to try rebooting the server. If that doesn't work, you'll probably want to write into (Support)[https://support.stripe.com/email] about this

saurabhd left a reply on After Adding Socialite Package Laravel 5.5 Login Stops Working • 1 month ago

I had the same problem on localhost:8000 (php artisan serve). Maybe it's coincidence, but try on "clean browser" , other than you used with previous development. For me it worked.

It seems that the problem is with cookies from development with previous Laravel versions, on the same url.

13th October, 2017

saurabhd left a reply on How To Update From Array • 1 month ago

You should try this:

$datas = array(array('id'=>1,'person'=>20),array('id'=>2,'person'=>40),array('id'=>3,'person'=>100));
foreach($datas as $data){
     DB::table('yourtablename')->where('id',$data['id'])->update(array('person'=>$data['person']));


}

Hope this work for you

12th October, 2017

saurabhd left a reply on QueryException SQLSTATE[42S02]: Base Table Or View Not Found • 1 month ago

Please follow this link

31st August, 2017

saurabhd left a reply on Laravel Email Error Failure Code And Reason • 2 months ago

@Dry7: Thanks for reply but I need to display error code with original reason while mail sending operation getting failed as website.

Let me know if you can help me in this area.

saurabhd left a reply on Laravel Package To Get The Width And Height Of Uploaded Video • 2 months ago

For server side Have ever tried (getID3)[https://github.com/JamesHeinrich/getID3), Using this you can get every detail of video via analyze() method at server side.

For client side Let's say you have HTML like: <input type="file" id="load-file" /><button type="button" id="done-button">Get me dimensions</button>

Use jQuery FileReader like:

<script src="//cdn.jsdelivr.net/jquery/2.1.4/jquery.js"></script>
    <script>
(function ($) {
  $('#done-button').on('click', function () {//You can this even handle as you want...
    var file = $('#load-file')[0].files[0];
    var reader  = new FileReader();
    var fileType =  file.type;
    console.log("type", fileType);
    reader.addEventListener("load", function () {
      var dataUrl =  reader.result;
      var videoId = "videoMain";
      var $videoEl = $('<video id="' + videoId + '"></video>');
      $("body").append($videoEl);
      $videoEl.attr('src', dataUrl);

      var videoTagRef = $videoEl[0];
      videoTagRef.addEventListener('loadedmetadata', function(e){
        console.log(videoTagRef.videoWidth, videoTagRef.videoHeight);
      });

    }, false);

    if (file) {
      reader.readAsDataURL(file);
    }
  });

})(jQuery);
    </script>

saurabhd started a new conversation Laravel Email Error Failure Code And Reason • 2 months ago

Can anyone help me out on how to get the error code and reason when email fail to send?

I know about failures() method provided with laravel but I want is error failure code and reason.

Any help would be appreciated.

26th August, 2017

saurabhd left a reply on Trying To Get Property Of Non-object In Laravel 5.4 • 2 months ago

You should try this:

public function show()
        {
            $show=Post::latest()->first();
        return view('posts.show',compact('show'));     
    }

Hope this work for you!!!

saurabhd left a reply on How To Upload Image In Laravel • 2 months ago

You should try this:

$image = $request->file('cover_image');
$filename = $image->getClientOriginalName();

$year = Carbon::now()->year;


$uploaded = $image->move(public_path().'upload/images/products/'.$year, $filename);

$product = Product::create(array_merge($request->all(), ['cover_image' => 
          $filename]));

Hope this work for you !!!

25th August, 2017

saurabhd left a reply on Delete Method Not Allowed • 2 months ago

You should try this way:

Route::get('recherche/occasion/{occasion}', '[email protected]')->name('recherche.occasion.destroy');


<a class="glyphicon glyphicon-remove" href="{{ route('recherche.occasion.destroy', [$oc]) }}" data-method="delete"></a>

Hope this work for you!!!

saurabhd left a reply on PDOException : Could Not Find Driver. Running Wamp And Laravel 5.4 • 2 months ago

You should install PDO on your server. Edit your php.ini (look at your phpinfo(), "Loaded Configuration File" line, to find the php.ini file path). Find and uncomment the following line (remove the ; character):

;extension=pdo_mysql.so

Then, restart your Apache server. For more information, please read the documentation.

saurabhd left a reply on How To Write This Query • 2 months ago

Which query?

saurabhd left a reply on Count Only If Property Equals 1 • 2 months ago

You should try this way:

$rsltExercise = $exercise->exerciseAlternatives()->where('correct', 1)->get();

$cntExercise = count($rsltExercise);

OR

$exercise->exerciseAlternatives()->where('correct', 1)->count();

Hope this work for you!!!

saurabhd left a reply on Settings Session Flash Without $request • 2 months ago

Try this simple way:

In UserController:

public function makeAdmin($id)
{
    $user = DB::table('users')->find($id);

    $user->admin = 1;
    if ($user->save()) {
        Session::flash('success', 'User assigned admin role');
    } else {
        Session::flash('danger', 'could not be assigned admin role.');
    }

    return back();
}

In blade

<div class="flash-message">
    @foreach (['danger', 'success'] as $msg)
        @if(Session::has($msg))
            <p class="alert alert-{{ $msg }}">{{ Session::get($msg) }}</p>
        @endif
    @endforeach
</div>

That's it...

saurabhd left a reply on PDOException: SQLSTATE[HY000] [2002] Connection Refused In Unit Testing Via Phpstorm • 2 months ago

Just try with DB_HOST=localhost may this help you

24th August, 2017

saurabhd left a reply on How To Insert Dynamic Inputs With Laravel 5.2? • 2 months ago

@ShairaDC: Welcome:)

You can tick this answer as best solution for other people help.

saurabhd left a reply on How To Insert Dynamic Inputs With Laravel 5.2? • 2 months ago

Use route:

Route::post('user/{client_id}/payable/bill', array('as'=>'insertbill','uses'=>'[email protected]'));

Try form:

{!!Form::open(['route' => ['insertbill', $client_id], 'id'=>'frmsave', 'method'=>'POST'])!!}

And check at your store():

print_r($request->all()); exit;

saurabhd left a reply on How To Stop<script> Tag To Enter In The Db • 2 months ago

If you want to skip these tags, try to use strip_tags() function. Check further documentation here.

saurabhd left a reply on Define Existing Users Table For Make:auth • 2 months ago

@Dry7: Why you posting every/same answer twice? This might cause confusion

saurabhd left a reply on My Page Is Not Rendering • 2 months ago

Change below line code:

content = (typeof content !== 'undefined') ? content : 'content'; 

But this is not reason to cause of page not rendering. Provide your blade code

saurabhd left a reply on How To Use Blade Push Directive Inside View Composers. • 2 months ago

you may use the with method to add individual pieces of data to the view. Try with like:

$view->with(['key1' => $value1, 'key2' => $value2]);

Check further detail from documentation

saurabhd left a reply on How To Insert Dynamic Inputs With Laravel 5.2? • 2 months ago

@ShairaDC: What does 'route'=>null into Form::open?

Also are you able dd($request->all()); into store() method?, if yes, what it print?

saurabhd left a reply on PDOException: SQLSTATE[HY000] [2002] Connection Refused In Unit Testing Via Phpstorm • 2 months ago

Else, you can cross check MySQL database connection using command detail with connection configuration added into config file.

Specially for port, host, database, username, password. Hope this will help you to fix this cause....:)

saurabhd left a reply on PDOException: SQLSTATE[HY000] [2002] Connection Refused In Unit Testing Via Phpstorm • 2 months ago

How did you connect MySQL database connection using command? using which port?

saurabhd left a reply on Pls Help! My Php Artisan Command Has Just Stopped Working. I Get A "[RuntimeException] Directory Name Must Not Be Empty" Error • 2 months ago

And what if you remove your own custom Model, if it again works fine the check that code having used realpath(__DIR__)?

If used then check print __DIR__;, may be this is the cause if you used as I described.

saurabhd left a reply on "Class 'Socialite' Not Found" • 2 months ago

@pritam1605 Use below artisan command, may be after you configure setup done you forgot to run this. Typically this command will cache all of your configuration files.

php artisan config:cache

23rd August, 2017

saurabhd left a reply on Laravel Package, Install Over Composer? • 2 months ago

Now register your package at Packagist and done.

saurabhd left a reply on How Do I Write Below Query To Update The Login Status Currently Logged In Adminusers • 2 months ago

Ok, check this:

$user_email = Auth::user()->email;

$status = \DB::table('admin')
->where('login_status','no')
->where('email', $user_email);

If it not work, check $user_email value

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.