Snapey

at Novate / Microlise

Hire Me

Experience

473,525

748 Best Reply Awards

  • Member Since 2 Years Ago
  • 769 Lessons Completed
  • 1 Favorite

26th May, 2017

Snapey left a reply on Error Messages Are Not Shown After Validation • 30 minutes ago

Do you have working session storage?

Are users logged in correctly and maintained from page to page?

Snapey left a reply on Why Does WhereHas With Where Break The Query? • 38 minutes ago

log and compare the SQL queries?

Snapey left a reply on Use And Namespace • 41 minutes ago

It should be in the Soulfy folder

25th May, 2017

Snapey left a reply on How To Save Multiple Query Rows Of Data With Additional Input Fields Data In A New Table? • 7 hours ago

you will learn more if you take the time to review the browser development tools.

you can then see what your elements are called and what is posted to the server when you press submit

i don't think your problems are laravel related yet

Snapey left a reply on Blade Template Issue • 8 hours ago

it's probably to do with the path and the fact that the css is relative to the current url

make your css linked to the root by starting the css path with a slash

@section('css') {!! Html::style('/css/liste.css') !!} @endsection

Snapey left a reply on Laravel , Different Registration Form For User And Editor • 8 hours ago

don't get too hung up about it being registration. Just think of it like any other crud.

how would you do it if it were any another model?

The only difference with registration is that you might want to log the user in also after, but that is quite easy.

Snapey left a reply on Conversion Failed When Converting Datetime From Character String. • 8 hours ago

you need to sort the form out first. You should probably name the fields hours and minutes. at the moment they share the same name.

also, your old function. you cannot add this to the select element itself it must be selected against the correct option

Snapey left a reply on How To Auth With Laravel 5.4 • 9 hours ago

examine line 34 in your code and in the laravel source via the link i gave

Snapey left a reply on Hello Guys If This Has Happened To Someone Please Help,$ Php Artisan Make:view About File Does Not Exists • 10 hours ago

is that your exact command? You have a space between make: and view?

Snapey left a reply on How To Auth With Laravel 5.4 • 10 hours ago

So how come line 34 is different in your code compared to the github source;

https://github.com/laravel/framework/blob/5.4/src/Illuminate/Auth/GenericUser.php#L34

You reference a non-existent column name - hence the error.

Snapey left a reply on How To Auth With Laravel 5.4 • 12 hours ago

What version are you using? Have you started with an earlier version and migrated?

Latest version does not use 'username' (not sure it has ever).

Snapey left a reply on How To Auth With Laravel 5.4 • 1 day ago

Sending and email (for verification) is not done out of the box.

As we don't know what GenericUser.php is we can't really help there.

24th May, 2017

Snapey left a reply on Working With HEX Values. • 1 day ago

shit. sorry some jerk posted irrelevant answer on a 5 month old thread

Snapey left a reply on Working With HEX Values. • 1 day ago

if you use non-integer ids as primary keys then you need to tell Eloquent (assuming you use eloquent models)

add to your model

public $incrementing=false;

Snapey left a reply on How To Auth With Laravel 5.4 • 1 day ago

for familiarisation, start with a fresh database or rename your existing table. you can come back to your old data later

Snapey left a reply on How To Get An Id Of The User After Registration??? • 1 day ago

if you are using built-in user registration then the user is logged in after registration and their ID can be got with auth()->id;

Snapey left a reply on How To Auth With Laravel 5.4 • 1 day ago

it's there in the docs in three lines of the introduction

https://laravel.com/docs/5.4/authentication

Snapey left a reply on How To Auth With Laravel 5.4 • 1 day ago

They're trying to create a User instance for this session

NO. This is creating a new user record in the database. User is the model, Create is the method. This code is what you would find in registration of a new user.

TokenMismatchException means a new session has been created but the ID doesn't rhyme with what's in my page header (or something like that).

Token mismatch means you have POSTed a form to the server without including a CSRF field that proves that the form originated from your application.

Its these basics that need covering with the laravel from scratch series or many of the written tutorials that are out there.

hat's why it seems like a myth to me because none of you experienced all the horrors I have described.

Why do you think that is? I'll tell you... its because we can follow guidance.

Snapey left a reply on How To Auth With Laravel 5.4 • 2 days ago

You understand what this does then?

User::create([
        'username' => strtolower(Input::get('username')),
        'password' => Hash::make(Input::get('password')),
        ]);

remember, this is a trick question. This is your code... what you wrote...

Just start again in a clean directory. Run the php artisan make:auth then play around with USING it. Understand HOW it registers new users. What happens when you login or request a password reset etc.

Once you have done that, and you are starting from a base of it working, you can think about refactoring to work the way you want it to work if you have some unusual use case.

Alternatively you can think, you know what, this does most of what I need, I will leave it alone for now and concentrate on the rest of my application then come back to this later when I understand the framework better

Authentication is a vital part of the safety of your application - dick around with it and get it wrong and you risk yours and your user's data.

23rd May, 2017

Snapey left a reply on View Not Displaying Changes After Update • 2 days ago

you should always finish the POST with a redirect.

the resulting GET will fetch the results again. it's not possible to pass data from one method to the other apart from what you flash to the session.

Snapey left a reply on View Not Displaying Changes After Update • 2 days ago

after making the update with Post you should return a redirect to the display page.

after the post, your browser is not expecting updated content.

Snapey left a reply on Property [***] Does Not Exist On This Collection Instance. • 2 days ago

Each comment needs a pointer (foreign key) to the Hotel. It could use id or hotel_id - which one depends on what you did when you stored the comment.

It sounds like your issue is in grabbing the hotel with its comments (which you should do with eager loading by the way).

Snapey left a reply on Get Data In All View • 2 days ago

use view composer, as per the docs. It is what they were made for.

https://laravel.com/docs/5.4/views#view-composers

Although you register the view composer at boot, it is not called until the view is rendered.

also, sort out your web server, you should not see public in your URLs. This will cause you nothing but problems.

Whatever web server you are using, change the document root

Snapey left a reply on Users Table Schema • 2 days ago

If its 1:1, i.e. every login user will have a profile, then I don't see much disadvantage in having a very wide table rather than two or more tables.

If your design is rapidly changing, you might prefer the flexibility of several smaller tables (e.g. less of an impact when the boss decides every user should store their favourite food).

Once is not one to one (e.g., user might have two addresses) then that should be a separate entity.

You might also need to consider classification of data. For instance you may prefer to put all PII data in a separate table so that it can be encrypted with the User table just used for logins?

Snapey left a reply on How To Auth With Laravel 5.4 • 2 days ago

It just works out of the box.

You don't do your "laravel is crap, I could have done this in 30 minutes" case any favours when you do this;

if (Auth::attempt(Input::all())) {
        User::create([
        'username' => strtolower(Input::get('username')),
        'password' => Hash::make(Input::get('password')),
        ]);

so just so that we understand each other, you check the users login credentials and then create a user ??

Snapey left a reply on Can't Get Image From Storage... • 2 days ago

Yes, but maybe ownership rather than permissions?

Are these files you copied up to the web server or files that your web server created itself?

if you can, ls -l the storage/public folder and check the owner and group of the files.

Snapey left a reply on Edit Patch A Form - Error NotFoundHttpException In Handler.php Line 102: No Query Results For Model [App\Post]. • 2 days ago

nothing odd there either (I was looking for a with or appends that might cause other activities)

The instances of grammar errors all seem to be linked to where conditions. You only have a simple find (or a variant).

Are you passing a simple id or attempting to locate posts by their slug - i.e., is id an integer or something else?

22nd May, 2017

Snapey left a reply on Edit Patch A Form - Error NotFoundHttpException In Handler.php Line 102: No Query Results For Model [App\Post]. • 3 days ago

nothing obviously wrong here. Anything unusual about your Post model?

Snapey left a reply on Can't Get Image From Storage... • 3 days ago

403 error? that is strange. you should be getting file not found if anything.

If you remove the symbolic link, do you then get not found or do you still get 403?

Snapey left a reply on Edit Patch A Form - Error NotFoundHttpException In Handler.php Line 102: No Query Results For Model [App\Post]. • 3 days ago

can you show the top 5 or so lines from the stack trace?

wrap code on the forum with three backticks ```

Snapey left a reply on Edit Patch A Form - Error NotFoundHttpException In Handler.php Line 102: No Query Results For Model [App\Post]. • 3 days ago

did you change your route to use {id} instead of {post} ?

it needs to match between your route and the method signature

21st May, 2017

Snapey left a reply on Error: Property * Does Not Exist On This Collection Instance. • 4 days ago

oh, thats ok then - as long as you sorted it !

Snapey left a reply on Seed A Column In The Middle Of Register An User • 4 days ago

just a couple of thoughts

a) you should not need to store this in the database if it is made of other existing columns. Just create an accessor for it (assuming you will use eloquent models in your application

b) you will need to decide what to do if the user wants to change their name. Does the slug for their 'page' stay the same?

Snapey left a reply on Invalid Token For Email Password Reset • 4 days ago

using your database tools, if you run a sql query against the database with the token, does it find the relevant user?

Snapey left a reply on Undefined Variable: Posts • 4 days ago

ok so your blog homepage. what is the route and which controller/method is called?

Snapey left a reply on Invalid Token For Email Password Reset • 4 days ago

When testing in postman i don't need a csfr token

how so?

if the route is post through web.php then it needs csrf

Snapey left a reply on Undefined Variable: Posts • 4 days ago

can you show the relevant code then?

Snapey left a reply on MySQL Returning Incorrect Values. • 4 days ago

thanks @jlrdw for reminding me of that one. So the solution here is to ensure uuid is cast as string.

 $id = DB::table('profiles')->where("uuid", (string) $uuid)->value("id");

if this works, credit @jlrdw

Snapey left a reply on Invalid Token For Email Password Reset • 4 days ago

you are not confused with csrf token?

Snapey left a reply on Undefined Variable: Posts • 4 days ago

are you calling index or post?

you index function fetches books?

Snapey left a reply on Run Config Clear On Browser • 4 days ago

You could improve the security a little by ONLY running the config clear command and not any command

Snapey left a reply on How To Handle/filter Elements From Relation? • 4 days ago

Do you want to filter films that have action done, or a single film with the done actions

Snapey left a reply on Laravel Uploading Image Post • 4 days ago

Please mark the answer as correct

Snapey left a reply on MySQL Returning Incorrect Values. • 4 days ago

clearly you are doing something wrong...

Snapey left a reply on First() Vs Get() In This Example • 4 days ago

as correctly indicated by @topvillas, get() will always return a collection - even if your query could only ever return a single row.

So, the error is because collections don't have a categories method.

Snapey left a reply on MySQL Returning Incorrect Values. • 4 days ago

I ran this through Tinker on a database I have handy, and it seems to work correctly.

>>> DB::table('dogs')->where('Callname','~snH1GRX')->value('id')
=> 3
>>> DB::table('dogs')->where('Callname','aaa')->value('id')
=> null
>>>

Is there anyway you are misreading the behaviour? Are you definitely passing in an invalid uuid?

How are you checking that $id=1 ?

Snapey left a reply on Get HTTP Referer Without Passing Request Parameter • 4 days ago

Thats quite an important FYI

So, you are happy using $_SERVER? Problem solved?

20th May, 2017

Snapey left a reply on New Setup, Help Me Figure Out NotFoundHttpException • 5 days ago

as @Cronix said, you need to set the document_root of your web server to the public folder with hr

the best way to do this depends on your OS and how you serve content. I'm sure you will be able to google many articles for your mamp, wamp etc

Snapey left a reply on How To Modify Things In Default Register And Login Processes • 5 days ago

You can modify the Http/Controllers/Auth/RegisterController anyway you like.

You can also replace any of the functions in the RegistersUsers trait within the above controller and they will be used instead of the trait.

For instance;

    public function register(Request $request)
    {
        $this->validator($request->all())->validate();

        event(new Registered($user = $this->create($request->all())));

        $this->guard()->login($user);

        return $this->registered($request, $user)
                        ?: redirect($this->redirectPath());
    }

above is the register function from the trait

copy this into your RegisterController, and modify, e.g. ;

    public function register(Request $request)
    {
        $this->validator($request->all())->validate();

        event(new Registered($user = $this->create($request->all())));

        //$this->guard()->login($user);

        //return $this->registered($request, $user)
        //                ?: redirect($this->redirectPath());

    return redirect(route('login'));
    }

Regarding checking for a banned user, the docs already cover this type of test;

https://laravel.com/docs/5.4/authentication#authenticating-users (scroll down to specifying additional conditions )

Edit Your Profile
Update

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