Afaceri

PHP Developer at Afacerist.ro

Hire Me

Experience

14,920

0 Best Reply Awards

  • Member Since 1 Year Ago
  • 226 Lessons Completed
  • 10 Favorites

29th May, 2017

Afaceri left a reply on HasMany With OrderBy Clause • 4 weeks ago

Yes that line throws the error ... so I found the problem

My model uses SoftDeletes and it seems that`s something reletad to that.... when I remove SoftDeletes it works fine on localhost and production.

Can anybody explain what`s the link between SoftDeletes and orderBy cluse on hasMany ?

Also I because hasMany returns a collection cand pe sorted after using sortBy and it works fine with SoftDeletes

Afaceri started a new conversation HasMany With OrderBy Clause • 4 weeks ago

Hi there,

In my model I have this

    /**
     * The Quote Request has many Quotes
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function quotes() {
        return $this->hasMany('App\Quote')->orderBy('order')->orderBy('sendit_at');
    }

on localhost it works fine but on production

production.ERROR: exception 'BadMethodCallException' with message 'Method orderBy does not exist.

Anybody knows why ?

29th August, 2016

Afaceri left a reply on Laravel 5.3 Auth::user() Available In Controller • 9 months ago

It` works with ....

/*
     *  The authenticated user.protected
      *
      * @var \App\User|null
     */
    protected $user;


    /*
     * Is the user signed In?
     *
     * @var \App\User|null
     */
    protected $signedIn;




    public function __construct() {

        $this->middleware(function ($request, $next) {

            $this->user = $this->signedIn = Auth::user();

            return $next($request);
        });
    }

Afaceri started a new conversation Laravel 5.3 Auth::user() Available In Controller • 9 months ago

Hi,

In Laravel 5.2 I have in my Controller.php the following:

    protected $user;
   protected $signedIn;
   public function __construct() {
        $this->user = $this->signedIn = Auth::user();
    }

  In my routes file I have :

Route::group(['middleware' => ['auth']], function() {
     //  routes
}

.... $this->user is available in all controllers protected by middleware ['auth']

In Laravel 5.3 it does not work ... Why?

18th July, 2016

Afaceri left a reply on Subdomain Routing And Parameters • 11 months ago

So ... I have that in my routes file

Route::group(['domain' => '{director}.yourwebsite.com'], function () {

Route::get('/', ['as' => 'director', 'uses' => 'Director\[email protected]']);

});

and in my controller that

public function index(Director $director) {

     return $director->category;

}

You must use the same name on your route and model ... in my case director

17th February, 2016

Afaceri started a new conversation Artisan Error - Undefined Index: Cf-connecting-ip • 1 year ago

Hello

I have a website and I use CloudFlare ... when i try the command php artisan it throws an error:

[ErrorException] Undefined index: cf-connecting-ip

Anybody knows whay ?

26th January, 2016

Afaceri left a reply on Not Throw An Error When Variable Index Is Not Defined • 1 year ago

A general solution for that ?

For example: I saw that when I use this service: Rollbar (a service that monitors the exceptions and errors) my Laravel 5.1 app does not throw any error when a variable is not defined or when an index of an array is not defined.

Afaceri started a new conversation Not Throw An Error When Variable Index Is Not Defined • 1 year ago

I use Laravel 5.1 and I want to know how to suprime (not throw) an error when variabile is not defined or when an index of an array is not defined.

I know that you can do that but I don`t know how. Can anybody help me ?

15th January, 2016

Afaceri left a reply on Excluding URI From CSRF Protection Not Working • 1 year ago

public function __construct(Encrypter $encrypter)
{
    $this->encrypter = $encrypter;
    $this->except = ['page/thepage'];
}

14th January, 2016

Afaceri left a reply on Queue Laravel 5 Video Request • 1 year ago

Did you solve the problem? I receive the same error...

23rd November, 2015

Afaceri left a reply on Passing Variables To A Group Of Controllers And Views • 1 year ago

Thank You for your arnswer! Thats what Iam looking for ....

22nd November, 2015

Afaceri started a new conversation Passing Variables To A Group Of Controllers And Views • 1 year ago

I`am new o Laravel and I have this problem:

I`am building an app and this app has a section "MyAccount". In every page of this section I have a menu with: MyAccount etc and a dynamic list of Companies registered by the user.

ex menu: MyAccount Profile MyCompanies Company 1 Company 2 Other Settings

What is the best way to pass the list of the Companies registered by the user?

28th October, 2015

Afaceri left a reply on Laravel 5 Global Variables • 1 year ago

If you have a small app maybe you will fill confortable to store your globals as define('THUMBS_DIR','thumbs'); in your route file on app/Http/routes.php

27th October, 2015

Afaceri left a reply on CURL Error 60: SSL Certificate Problem: Unable To Get Local Issuer Certificate • 1 year ago

I had the same problem when I tried to make an app with Facebook login so the solution was that:

  1. changed the composer file composer.json to look like

"require": { "php": ">=5.5.9", "laravel/framework": "5.1.*", "laravel/socialite": "^2.0", "guzzlehttp/guzzle": "~4.0" },

  1. in command line type: composer update

I hope that you can use that...

Edit Your Profile
Update

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