SaeedPrez

Owner at SarviTech

Experience

198,170

365 Best Reply Awards

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

21st January, 2017

SaeedPrez left a reply on Using A Trait To Access Model Properties Directly • 3 hours ago

@Blackpig

So you want to pass a property name and then return the modified property? Something like this..

    public function doStuff($target)
    {
        return strtoupper($this->$target);
    }

SaeedPrez left a reply on Default Login Page Field Validation Fails • 3 hours ago

@Vamshi show the whole form and also show the validation..

SaeedPrez left a reply on Authentication Error • 3 hours ago

@mojemoron sorry, been out all day..

How did you export that table to your production server? Do you have any important data or can do run php artisan migrate:refresh?

Route::get('/test-route', function()  {
    dd(
        App\User::where('email', [email protected]')->count() . ' users +++++ ',
        \DB::select(\DB::raw('SHOW CREATE TABLE users'))
    );
});

Try adding this above code to your web.php routes file, replace [email protected] with the email you use to log in and then visit yoursite.com/test-route and post here what the output is.

SaeedPrez left a reply on Style Broken After Installing Laravel • 14 hours ago

Your broken styles problem is because your document root is wrong, so fix that and both your problems should get fixed.

https://stackoverflow.com/questions/38706375/how-to-change-the-www-root-directory-on-wampserver-3

20th January, 2017

SaeedPrez left a reply on Eager Loading Returns Null, But Normal Loading Works Fine • 1 day ago

@Paeolen the relationship column should be in the model that belongs to.. so if Detail belongs to User, then it is convention that the details table contains a user_id column.

SaeedPrez left a reply on Eager Loading Returns Null, But Normal Loading Works Fine • 1 day ago

Hi @Paeolen

If you're use ->select() make sure the relationship column in included or the database won't return that column and therefore Laravel can not match the relationship.

SaeedPrez left a reply on CSRF Middleware Not Running In Test • 1 day ago

@qwales1 Glad I could help ☺

SaeedPrez left a reply on CSRF Middleware Not Running In Test • 1 day ago

@qwales1

Open /app/Http/Middleware/VerifyCsrfToken.php and add you modifications there. You can for example copy the handle() method and remove the $this->runningUnitTests() || line..

SaeedPrez left a reply on CSRF Middleware Not Running In Test • 1 day ago

Hi @qwales1

This might be why..

SaeedPrez left a reply on Routing • 1 day ago

Also, Jeffrey Way has released new vides for every version, not as complete as the "From scratch" series but he has discussed and shown the changes..

SaeedPrez left a reply on Routing • 1 day ago

Current Laravel version is 5.3, in a few days Laravel 5.4 will be released and along with it Laracasts will release 5.4 videos.

SaeedPrez left a reply on Routing • 1 day ago

In Laravel 5.3 there is a routes folder that contains a web.php file, where you put your web routes.

There will be new tutorials for Laravel 5.4 as I understand it, so it's coming soon.

SaeedPrez left a reply on Authentication Error • 1 day ago

@mojemoron I don't know what to tell you, I have no idea what you have changed. All I can do is take it step by step until we find the problem..

The thing without ->unique() is that there could be multiple rows in your database using the same email/name. That is a reason for the login to fail.

Couple of questions..

  • Are you not using version control like git?
  • Also how about getting the working version from the server?

SaeedPrez left a reply on Where Clause Query Using Laravel Eloquent • 1 day ago

@princelionelnzi Ah, I see... try this..

$sector = Sector::with('offers.provider')->where('ref_id', $sectorId)->whereHas(
    'offers.provider' => function($query) {
        $query->where('status', 1);
    }
)->first();

SaeedPrez left a reply on Authentication Error • 1 day ago

@mojemoron couple of notes..

You have protected $username = 'name';which means you should be logging in with with name and password, not email and password.. are you doing that?

Your migration is setup to cause a lot of fails and headaches, the following columns should be changed to this..

            $table->string('name')->unique();
            $table->string('email')->unique();
            $table->string('password');

SaeedPrez left a reply on Where Clause Query Using Laravel Eloquent • 1 day ago

Sorry, it should not have been an array. I've updated my code.

I get only the sector and the offers and the providers

Not sure what you mean with that... What are you expecting to get in return?

SaeedPrez left a reply on Where Clause Query Using Laravel Eloquent • 1 day ago

$sector = Sector::where('ref_id', $sectorId)->whereHas([
    'offers.provider' => function($query) {
        $query->where('status', 1);
    }
])->first();

https://laravel.com/docs/5.3/eloquent-relationships#querying-relationship-existence

SaeedPrez left a reply on How To Avoid Concurent Logins In Laravel 5.1? • 1 day ago

@dovbeta glad I could help ☺

SaeedPrez left a reply on Passing Parameter From Controller To View Composer In Laravel 5.3 • 1 day ago

    public function compose(View $view)
    {
    $foo = 'Hello World;

        $view->with('foo', $foo);
    }

19th January, 2017

SaeedPrez left a reply on How To Use Paginate And Findwhere At The Same? (laravel 5.3) • 2 days ago

@moses what does ->findWhere() return, query builder instance or collection of models?

SaeedPrez left a reply on Getting A 'Trying To Get Property Of Non-object' Error That I Can't Track Down, Probably Related To Relationships • 2 days ago

@Waylander

Route::get('/{username}', [
    'uses' => [email protected]',
    'as' => 'account_real',
    'middleware' => 'auth'
]);

This is your problem.. you have a wildcard route before your catalog route,... move your catalog route above the wildcard route and it should start working.

SaeedPrez left a reply on Authentication Error • 2 days ago

@mojemoron

The reason I asked to see the migration was to make sure your password column is set to at least 60 characters long.

I'm not sure why you're showing me the trait, unless you have made changes to it?

SaeedPrez left a reply on Getting A 'Trying To Get Property Of Non-object' Error That I Can't Track Down, Probably Related To Relationships • 2 days ago

Hm, maybe the correct route is not being hit.. what happens if you change the replace the route with..

Route::get('/catalog',function() {
    return 'Route is working';
});

PS. Got practice, will be back in a few hours in case it's not solved.

SaeedPrez left a reply on Getting A 'Trying To Get Property Of Non-object' Error That I Can't Track Down, Probably Related To Relationships • 2 days ago

@Waylander just for the fun of it, what happens if you also send a real $user to the view?

SaeedPrez left a reply on Getting A 'Trying To Get Property Of Non-object' Error That I Can't Track Down, Probably Related To Relationships • 2 days ago

@Waylander

Edit:

Have you tried php artisan view:clear & php artisan clear-compiled?

SaeedPrez left a reply on Getting A 'Trying To Get Property Of Non-object' Error That I Can't Track Down, Probably Related To Relationships • 2 days ago

Hi @Waylander

<li><a href="{{ route('field', ['fieldname' => $field]) }}">{{ $field->name }}</a></li>

First think that caught my attention is the ['fieldname' => $field]... are you sending the whole model as fieldname ?

SaeedPrez left a reply on How To Resolve A Model Using A Static Method But Also Apply Query Scopes • 2 days ago

@mstnorris the problem is you're getting the model instance when you use ->first(), but you actually want to keep chaining to the query builder instance..

public static function findByToken($token)
{
    if (!is_null($bbToken = static::whereToken($token))) {
        return $bbToken;
    }
}

SaeedPrez left a reply on Authentication Error • 2 days ago

Hi @mojemoron

How are you authenticating users?

Can you show that whole controller where you log users in and also your users table migration..

Also, do you have any custom middleware or packages installed?

SaeedPrez left a reply on How To Avoid Concurent Logins In Laravel 5.1? • 2 days ago

@dovbeta

  1. Add a session_id column to your users table
  2. When a user logs in, get the old session id and destroy that session
  3. Save the new session id

18th January, 2017

SaeedPrez left a reply on Laravel Create() Ignores Certain Fields • 3 days ago

  • Try run php artisan clear-compiled and restart tinker
  • Can you show your migration and your User model?
  • Do you have any packages or custom middleware?

SaeedPrez left a reply on Laravel Create() Ignores Certain Fields • 3 days ago

@BernardK Did you make any changes to your code while tinker was running? If so try restart tinker..

SaeedPrez left a reply on Jquery UI Datepicker With Laravel • 3 days ago

@ImeDa

Sorry, but your statement is incorrect once more. Try this below code in a Laravel project and see the output for yourself.

Route::get('/test-date', function() {
    return \Carbon\Carbon::createFromFormat('d-m-Y', '31-03-1991');
});

SaeedPrez left a reply on Auto Run Tests In Subfolders • 3 days ago

@EmilMoe you're welcome ☻ Glad I could help.

SaeedPrez left a reply on How To Check In Laravel 5.3 If User Entered Url Address Directly Or Came From Other Resource? • 3 days ago

// Facade
Request::server('HTTP_REFERER');

// Global helper
request()->server('HTTP_REFERER');

SaeedPrez left a reply on Problem With If Else In The Blade • 3 days ago

@maxnb hm, I think Laravel thinks the (show) belongs to @else, like @else(show)..

Break it into a few lines and it will work..

    @if(false)
        (hide)
    @else
        (show) a
    @endif

SaeedPrez left a reply on Bulma Stack Order • 3 days ago

You're welcome @kenny11, glad I could help ☺

SaeedPrez left a reply on Bulma Stack Order • 3 days ago

I tried to search in the grid sass files for order but couldn't find anything so I'm assuming there is no flexbox ordering support in the current release.

SaeedPrez left a reply on Auto Run Tests In Subfolders • 3 days ago

@EmilMoe

I found another (read better) way..

Open your phpunit.xml file and add your path there..

    <testsuites>
        <testsuite name="Application Test Suite">
            <directory suffix="Test.php">./tests</directory>
            <directory suffix="Test.php">./projects</directory>
        </testsuite>
    </testsuites>

SaeedPrez left a reply on Bulma Stack Order • 3 days ago

@kenny11

You're on the right track, but you have to think in reverse (mobile first) because Bulma doesn't use flex box on mobile. Add the columns in the order you want on mobile, then use order: X for bigger screens.

Example https://jsbin.com/numilisasa/edit?html,css,output

17th January, 2017

SaeedPrez left a reply on How To Format 'Created_at' In Blade Using Carbon • 3 days ago

Are you using the query builder instead of Eloquent or how are you getting the data?

Anyhow, you could always parse a string date..

\Carbon\Carbon::parse($quotation[0]->created_at)->format('d/m/Y');

SaeedPrez left a reply on Laravel 5.3 Displaying Error Message • 4 days ago

Check your .env file..

APP_DEBUG=true
APP_LOG_LEVEL=debug

SaeedPrez left a reply on Auto Run Tests In Subfolders • 4 days ago

Can't you create a bash/bat file in the root folder called phpunit and add all paths there?

vendor/bin/phpunit tests
vendor/bin/phpunit projects
vendor/bin/phpunit packages

Or maybe create a symlink in the tests folder to those other folders (if that works, not a Linux guy)..

SaeedPrez left a reply on UPDATED IN LARACASTS FORUM • 4 days ago

My guess is he uses something like Redis

16th January, 2017

SaeedPrez left a reply on Ajax (jQuery) & CSRF • 5 days ago

@DavidPowersOG

Take a look at this

SaeedPrez left a reply on Jquery UI Datepicker With Laravel • 5 days ago

@ImeDa

You have to change date format before saving it in database like this

Actually, that statement is false. You can save a carbon instance in a date column.

SaeedPrez left a reply on Jquery UI Datepicker With Laravel • 5 days ago

Hi @djay, try this..

$date = \Carbon\Carbon::createFromFormat('d-m-Y', '31-03-1991');
Edit Your Profile
Update

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