Support the ongoing development of Laravel.io →
posted 9 years ago
Requests
Last updated 1 year ago.
0

I have similar application, and I settled for query based on username instead of id. Another option is to have username as primary key (if usernames are unique)

Last updated 1 year ago.
0

Hmm okay... well I think I'd add an index to the field. Sorry I wasn't being totally specific, it isn't a user name, it's actually a first name and last name - IDEALLY it would look like this (sorry should have said before):

www.site.com/{firstname}{lastname[0]}/

so for John Doe it would be:

www.site.com/JohnD

So this being the case there is no unique constraint on first name or last name. One workaround I thought would be to make it {firstname}{lastname[0]}/{id}, which would suffice.

edit: I don't reckon I'd get the first index of the variable like that, but just for the sake of explanation.

Last updated 1 year ago.
0

Yeah I guess I'll just go with ID for now. This idea is sort of in conjunction with the theme of the website, but it's not an essential requirement. Thanks for taking a look anyway.

Last updated 1 year ago.
0

What you should do is in your link do this:

yourpage.blade.php:

{{ URL::route('routename',$user->id) }}

in routes:

Route::get('/page/{id}',array( 'as'=>'routname', 'uses'=>'YourController@getId' ));

controller:

    public function getId($id) {
            $user = DB::table('users')->where('id','=',$id);
            $user->delete();
    }
Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Meowts meowts Joined 10 Jun 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.