SaeedPrez

Founder at Sarvitech

Experience

299,850

466 Best Reply Awards

  • Member Since 1 Year Ago
  • 799 Lessons Completed
  • 1 Favorite

20th March, 2017

SaeedPrez left a reply on AppServiceProvider Giving Me Non-object • 4 days ago

@jrock2004 no worries..

You actually did me a big favor and opened my eyes, made me realize I'm spending way too much time (2+ hrs/day) on this forum trying to solve other people's problems.

Today is actually Persian new year, it's a good day to make a change. Perhaps focus more on my own problems, also on family and friends.

Thank you and good luck.

SaeedPrez left a reply on AppServiceProvider Giving Me Non-object • 4 days ago

@jrock2004 had you shown the whole if/else statement this would have been solved in 2 minutes.. but you showed this..

@if (Auth::guest() && $isUserRegEnabled == true)
    ....
@endif

FML,..

SaeedPrez left a reply on AppServiceProvider Giving Me Non-object • 4 days ago

@Snapey

The code will work if I take out the && $isUserRegEnabled.

This is what threw me off, how would you explain this? The error message has nothing to do with undefined variable.. It makes no sense to me why it would work if he removes the variable..

...unless, if he has a @else that he didn't show..

SaeedPrez left a reply on Illegal String Offset 'name'.how To Solve This Error Can Anyone Please Tell Me • 4 days ago

@jhansi I can't see the screenshots, the page requires me to login..

SaeedPrez left a reply on AppServiceProvider Giving Me Non-object • 4 days ago

@jrock2004 hm, are you using paginator? If so, try disable that (use ->get() instead) and see if that changes anything..

19th March, 2017

SaeedPrez left a reply on Method [guest] Does Not Exist On Redirect. • 5 days ago

I'm not really sure why it's giving you the wrong class, but some things you can try..

  • run composer dump-autoload and php artisan optimize
  • delete the vendor folder and run composer install or composer update to update to latest versions
  • create a new Laravel project and move your code over there step by step, to see if and when it fails (what makes it fail)
  • open an issue on GitHub for laravel/framework

SaeedPrez left a reply on Method [guest] Does Not Exist On Redirect. • 5 days ago

From what I can understand, you're getting the wrong class, it should call guest() on \Illuminate\Routing\Redirector and not \Illuminate\Http\RedirectResponse..

SaeedPrez left a reply on Method [guest] Does Not Exist On Redirect. • 5 days ago

Hm.. the code you've provided is fine but have you changed anything in the auth controllers, added any middleware or packages?

SaeedPrez left a reply on Method [guest] Does Not Exist On Redirect. • 5 days ago

Can you paste the whole error?

SaeedPrez left a reply on Call A PHP Page (not Blade) From A Controller • 5 days ago

You call it exactly like you call a blade template.

// Would return resources/views/test.blade.php or test.php
return view('test');

SaeedPrez left a reply on Feedback To My Media Sharing Site • 5 days ago

No problem, good luck with the site.

SaeedPrez left a reply on AppServiceProvider Giving Me Non-object • 5 days ago

I don't see anything wrong the code you've provided and I don't think the error Trying to get property of non-object is because Laravel can't find the variable, if it was it would say Undefined variable,..

What happens if you instead try..

public function boot()
{
//    view()->composer('shared.nav', function($view)
//   {
//        $view->with('isUserRegEnabled', config('app.ALLOW_REGISTRATION', false));
//    });
    
    view()->share('isUserRegEnabled', config('app.ALLOW_REGISTRATION', false));
}

SaeedPrez left a reply on AppServiceProvider Giving Me Non-object • 5 days ago

@jrock2004

I copy/pasted your code just like it is in a project of mine and it works fine, I only changed the view name.

What happens if you remove the variable, does it work then?

@if (Auth::guest())
    ....
@endif

If it works without $isUserRegEnabled, double check the spellings and view names. Also try clear the view cache with php artisan cache:clear .. hm..

SaeedPrez left a reply on Feedback To My Media Sharing Site • 5 days ago

Hi @Chris1904

The site looks very nice, I like the clean design. A few minor things..

  • The report abuse page is blank
  • If you go to the popular page and change the view to bigger pictures, there is a bug
  • If you go to forgot password page, the login/register links are broken
  • On the register page, there is no client side validation which is very annoying because you get the reCaptcha and then it submits and you get the errors, which means you have to do the reCaptcha again and again until you get it right.
  • On the affiliate page, why is it per 10 000 instead of per 1 000?

18th March, 2017

SaeedPrez left a reply on The Bug Without Any Information • 6 days ago

Sounds like somewhere you have an unintended i character, echo 'i' or something similar.

17th March, 2017

SaeedPrez left a reply on Invalid Argument Supplied For Foreach() • 1 week ago

Glad it got solved ☺

SaeedPrez left a reply on Laravel MethodNotAllowedHttpException For Request • 1 week ago

No one can help you without wildly guessing when you change the actual code that is causing the problem.

Here's my guess, make sure you don't have a trailing slash in the URL when sending the ajax request.

SaeedPrez left a reply on Override Auth Function To Create Login Form In Which User Can Login With Email Id Or Phone Number • 1 week ago

I think the SUPER BEST way is if you write your own framework from the ground up, that way you can make it exactly the way you want it.

SaeedPrez left a reply on Illegal String Offset 'name'.how To Solve This Error Can Anyone Please Tell Me • 1 week ago

@jhansi

Let's assume you have the following array..

$data = [
    ['name' => 'Saeed Prez',    'email' => [email protected]'],
    ['name' => 'John Doe',      'email' => [email protected]'],
    [                       'email' => [email protected]']
];

Then you do a foreach..

foreach($data as $person) {
    $contacts[] = ['name' = $person['name'], 'email' => $person['email']];
}

This will cause the error illegal string offset 'name' because the 3rd $person has no name offset.

SaeedPrez left a reply on Override Auth Function To Create Login Form In Which User Can Login With Email Id Or Phone Number • 1 week ago

Hi @bipin

Add this to your Auth/LoginController.php..

    public function username()
    {
    // Assuming your email/phone input name is login
        return filter_var(request('login', FILTER_VALIDATE_EMAIL)
        ? 'email'
        : 'phone';
    }

NEVER CHANGE ANYTHING INSIDE THE VENDOR FOLDER!!

SaeedPrez left a reply on Illegal String Offset 'name'.how To Solve This Error Can Anyone Please Tell Me • 1 week ago

Well, it's complaining that your array does not have the key/offset name. This can be caused even if only one of your arrays doesn't have that key.

So you need to check the data you're sending into the foreach loop.

SaeedPrez left a reply on Illegal String Offset 'name'.how To Solve This Error Can Anyone Please Tell Me • 1 week ago

@jhansi did this not solve your problem illegal string offset 'name' ?

SaeedPrez left a reply on Illegal String Offset 'name'.how To Solve This Error Can Anyone Please Tell Me • 1 week ago

This line is the problem,..

$insert[] = ['name' => $v['name'], 'email' => $v['email'],'Team' => $v['Team'],'Vendor' => $v['Vendor'],'password'=>$v['password'];

SaeedPrez left a reply on Invalid Argument Supplied For Foreach() • 1 week ago

Try add this to your post model..

  public function testXY()
    {
        return $this->hasMany(Attachment::class);
    }

Then try..

Route::get('test', function(){
  $posts = App\Announcement::with('comments', 'testXY')->get();

  foreach($posts as $post){
    dd($post->testXY);
  }
});

Does it work or is it still the same?

16th March, 2017

SaeedPrez left a reply on POST Returns 405 Via Ajax, While PUT And Non-ajax POST Returns 200 • 1 week ago

Alright, glad I could help ☺ I learned something also..

SaeedPrez left a reply on POST Returns 405 Via Ajax, While PUT And Non-ajax POST Returns 200 • 1 week ago

@krecebli this rewrite rule is included in the default .htaccess that comes with Laravel, so it doesn't affect other projects and/or frameworks. It affects the folder (including sub-folders) where you have the .htaccess file.

SaeedPrez left a reply on POST Returns 405 Via Ajax, While PUT And Non-ajax POST Returns 200 • 1 week ago

Actually, I just looked over the .htaccess file and this☺ ..

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

SaeedPrez left a reply on POST Returns 405 Via Ajax, While PUT And Non-ajax POST Returns 200 • 1 week ago

@krecebli I think it's because of your web server, it's redirecting routes with trailing slashes.. try the default laravel .htaccess, maybe it can fix the problem.

https://github.com/laravel/laravel/blob/master/public/.htaccess

SaeedPrez left a reply on POST Returns 405 Via Ajax, While PUT And Non-ajax POST Returns 200 • 1 week ago

Try this..

    url: '/post/add/', // change this
    url: '/post/add', // to this

SaeedPrez left a reply on Potential Bug • 1 week ago

Testing..

SaeedPrez started a new conversation Potential Bug • 1 week ago

Something broke the other thread, gonna see if I can reproduce it.

// I think it was this..

@php dd() @endphp

SaeedPrez left a reply on POST Returns 405 Via Ajax, While PUT And Non-ajax POST Returns 200 • 1 week ago

Looks like we found the source of the problem.. now we need to figure out why it's redirecting..

If you click on the redirect line in your network tab, it should provide more information.. see if you can find anything useful there.

Also try this and see if it works..

// Route::post('post/add', [email protected]')->middleware('auth');

Route::post('post/add', function() {
    return 'Post added';
});

SaeedPrez left a reply on Invalid Argument Supplied For Foreach() • 1 week ago

I think I broke the forum, can't edit my post.. I meant to post this..

@foreach ($posts as $post)    
   @php dd($post->attachments) @endphp
@endforeach

SaeedPrez left a reply on Invalid Argument Supplied For Foreach() • 1 week ago

Np, for future reference, the link is below the reply box and contains more info..

About your problem, what do you get if you try this..

@foreach ($posts as $post)    
  @foreach ($post->attachments as $file)
   @php dd($post->attachments) @endphp
  @endforeach
@endforeach

SaeedPrez left a reply on POST Returns 405 Via Ajax, While PUT And Non-ajax POST Returns 200 • 1 week ago

Check the network tab on your browser's developer tools, see if the correct request is being sent and what error message is being returned.

SaeedPrez left a reply on POST Returns 405 Via Ajax, While PUT And Non-ajax POST Returns 200 • 1 week ago

Hm, if you're using jQuery, then try..

    type: 'POST', // change this
    method: 'POST', // to this

SaeedPrez left a reply on Undefined Variable: Selected Error In Select Option List From Foreach Loop • 1 week ago

@Bonboni this video series is priceless, if you haven't watched it already, stop coding, watch it a couple of times, then continue..

SaeedPrez left a reply on Undefined Variable: Selected Error In Select Option List From Foreach Loop • 1 week ago

                                    @foreach($tourType->tours as $tour)
                                        <option value="{{ $tour->_kpnID }}" {{ $tour->_kpnID == $TourID ? 'selected' : '' }}>{{ $tour->tDescription }}</option>
                                    @endforeach

SaeedPrez left a reply on POST Returns 405 Via Ajax, While PUT And Non-ajax POST Returns 200 • 1 week ago

You probably have a wildcard route that catches the request before it has a chance to reach the correct route.. For testing, try move this route to top of your routes file and see if the problem still exists..

If you need mor help, post your whole routes file.

SaeedPrez left a reply on Problem With Laravel Mix • 1 week ago

The answer is in the documentation:

SaeedPrez left a reply on Payment • 1 week ago

Maybe get a virtual credit card, https://www.coinizy.com/

SaeedPrez left a reply on Payment • 1 week ago

Paypal is also an option: https://laracasts.com/paypal

SaeedPrez left a reply on Making Api Calls The Right Way • 1 week ago

Or you could create a class called Youtube, then you could add methods like Youtube::video('3werer4343')->getInfo();

15th March, 2017

SaeedPrez left a reply on Login By Username In Laravel 5.3? • 1 week ago

@marknt15 Glad it helped ☺

14th March, 2017

SaeedPrez left a reply on Variable Access Issue From Blade Template • 1 week ago

@lakmalp Glad to help ☺

SaeedPrez left a reply on Variable Access Issue From Blade Template • 1 week ago

No, but you can use..

$result = DB::table(Company::_TABLE_)->pluck('description', 'company_id');

SaeedPrez left a reply on Variable Access Issue From Blade Template • 1 week ago

$companies = Company::pluck('name', 'id');
Edit Your Profile
Update

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