Correspondance les uns aux autres

voix
0

entrez

Comment puis - je faire que sur cliquant sur le bouton soumettre, correspondent aux utilisateurs les uns aux autres, comme les règles « Secret Santa »? Vous ne devriez pas être le Père de vous - même, et vous ne devriez pas être le Père de quelqu'un qui est déjà votre Père Noël. Après cela , je vais filtre user->groups(Tags indiqué sur la photo)

Ceci est mon .blade.php:

@extends('layouts.app')
@section('content')
<div class=container>
    <div class=row justify-content-center>
        <div class=col-md-8>
            <div class=card>
                <div class=card-header>{{ __('List') }}</div>
                <div class=card-body>
                    <form action=>
                 @foreach($users as $user)
                    <div class=users-list style=padding: 5px 0>
                    <h5>{{ $user->name }}</h5>
                        <p class=badge badge-primary>{{ $user->group }}</p>
                    </div>
                @endforeach
                <input class=btn btn-primary w-100 type=submit value=Submit>
            </form>

                </div>
        </div>
    </div>
</div>
@endsection

Et voici ma RegisterController.php:

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;

class RegisterController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Register Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users as well as their
    | validation and creation. By default this controller uses a trait to
    | provide this functionality without requiring any additional code.
    |
    */

    use RegistersUsers;

    /**
     * Where to redirect users after registration.
     *
     * @var string
     */
    protected $redirectTo = '/home';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest');
    }

    /**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
    protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => ['required', 'string', 'max:255'],
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
            'password' => ['required', 'string', 'min:8', 'confirmed'],
        ]);
    }

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return \App\User
     */
    protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'group' => $data['group'],
            'wish' => $data['wish'],
            'password' => Hash::make($data['password']),
        ]);
    }

}
Créé 02/12/2019 à 23:58
source utilisateur
Dans d'autres langues...                            


1 réponses

Correspondance les uns aux autres

voix
0

entrez la description d'image ici

Comment puis - je faire que sur cliquant sur le bouton soumettre, correspondent aux utilisateurs les uns aux autres, comme les règles « Secret Santa »? Vous ne devriez pas être le Père de vous - même, et vous ne devriez pas être le Père de quelqu'un qui est déjà votre Père Noël. Après cela , je vais filtre user->groups(Tags indiqué sur la photo)

Ceci est mon .blade.php:

@extends('layouts.app')
@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">{{ __('List') }}</div>
                <div class="card-body">
                    <form action="">
                 @foreach($users as $user)
                    <div class="users-list" style="padding: 5px 0">
                    <h5>{{ $user->name }}</h5>
                        <p class="badge badge-primary">{{ $user->group }}</p>
                    </div>
                @endforeach
                <input class="btn btn-primary w-100" type="submit" value="Submit">
            </form>

                </div>
        </div>
    </div>
</div>
@endsection

Et voici ma RegisterController.php:

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;

class RegisterController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Register Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users as well as their
    | validation and creation. By default this controller uses a trait to
    | provide this functionality without requiring any additional code.
    |
    */

    use RegistersUsers;

    /**
     * Where to redirect users after registration.
     *
     * @var string
     */
    protected $redirectTo = '/home';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest');
    }

    /**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
    protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => ['required', 'string', 'max:255'],
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
            'password' => ['required', 'string', 'min:8', 'confirmed'],
        ]);
    }

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return \App\User
     */
    protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'group' => $data['group'],
            'wish' => $data['wish'],
            'password' => Hash::make($data['password']),
        ]);
    }

}
Créé 02/12/2019 à 23:58
source utilisateur

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more