Odpovídající uživatelům mezi sebou

hlasů
0

zadejte

Jak si mohu udělat, aby na kliknutí na tlačítko odeslat, odpovídá uživatelům mezi sebou, stejně jako „Secret Santa“ pravidla? Ty by neměly být Santa sebe, a neměli byste mít Santa někoho, kdo je již vaše Santa. Poté se budu filtr user->groups(tagy znázorněno na fotografii)

To je můj .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

A tohle je můj 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']),
        ]);
    }

}
Položena 02/12/2019 v 23:58
zdroj uživatelem
V jiných jazycích...                            


1 odpovědí

Odpovídající uživatelům mezi sebou

hlasů
0

zadejte popis obrázku zde

Jak si mohu udělat, aby na kliknutí na tlačítko odeslat, odpovídá uživatelům mezi sebou, stejně jako „Secret Santa“ pravidla? Ty by neměly být Santa sebe, a neměli byste mít Santa někoho, kdo je již vaše Santa. Poté se budu filtr user->groups(tagy znázorněno na fotografii)

To je můj .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

A tohle je můj 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']),
        ]);
    }

}
Odpovězeno 02/12/2019 v 23:58
zdroj uživatelem

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