Commit f9fc14c4 authored by quentin.vrel's avatar quentin.vrel

Formulaire Laravel créé

parent aa453f50
<?php
namespace App\Models;
namespace App;
use Illuminate\Database\Eloquent\Model;
class Game extends Model
{
protected $connection = 'esport';
protected $connection = 'mysql';
protected $table = 'game';
protected $primaryKey = 'gamer_id';
public $incrementing = true;
......
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Game;
class TournamentController extends Controller
{
public function index() {
$games = Game::all();
return view('create-tournament', ['games' => $games]);
}
public function createTournament(){
}
}
<?php
namespace App\Models;
namespace App;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
......
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
@if (isset($post))
@if($post)
<div class="alert alert-success" role="alert">
Le tournoi a été créé.
</div>
$else
<div class="alert alert-danger" role="alert">
Un erreur est intervenue, merci de réessayer.
</div>
@endif
@endif
<div class="card-header">Créer un tournoi</div>
<div class="card-body">
<form method="POST" action="/form">
@csrf
<div class="form-group row">
<label for="select-game" class="col-md-4 col-form-label text-md-right">Choisissez un jeu</label>
<div class="col-md-6">
<select name="select-game" id="select-game" class="custom-select" required autofocus>
@foreach ($games as $game)
<option value="{{ $game->id_game }}">{{ $game->id_game }}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group row">
<label for="tournament-name" class="col-md-4 col-form-label text-md-right">Nom du tournoi</label>
<div class="col-md-6">
<input name="tournament-name" id="tournament-name" type="text" class="form-control" required>
</div>
<div class="invalid-feedback">
Veuillez saisir un nom.
</div>
</div>
<div class="form-group row">
<label for="date-begin" class="col-md-4 col-form-label text-md-right">Date du début du tournoi</label>
<div class="col-md-6 row pr-0" name="date-begin" id="date-begin">
<div class="col-md-3">
<select name="day-begin" id="day-begin" class="custom-select" required autofocus>
@for ($i = 1; $i < 32; $i++)
<option value="{{ $i }}">{{ $i }}</option>
@endfor
</select>
</div>
<div class="col-md-5">
<select name="month-begin" id="month-begin" class="custom-select" required autofocus>
@for ($i = 1; $i < 13; $i++)
<option value="{{ $i }}">{{ date('F', mktime(0,0,0,$i) ) }}</option>
@endfor
</select>
</div>
<div class="col-md-4">
<select name="day-begin" id="day-begin" class="custom-select" required autofocus>
@for ($i = date('Y'); $i < date('Y') + 20; $i++)
<option value="{{ $i }}">{{ $i }}</option>
@endfor
</select>
</div>
</div>
</div>
<div class="form-group row">
<label for="date-end" class="col-md-4 col-form-label text-md-right">Date du fin du tournoi</label>
<div class="col-md-6 row pr-0" name="date-end" id="date-end">
<div class="col-md-3">
<select name="day-end" id="day-end" class="custom-select" required autofocus>
@for ($i = 1; $i < 32; $i++)
<option value="{{ $i }}">{{ $i }}</option>
@endfor
</select>
</div>
<div class="col-md-5">
<select name="month-end" id="month-end" class="custom-select" required autofocus>
@for ($i = 1; $i < 13; $i++)
<option value="{{ $i }}">{{ date('F', mktime(0,0,0,$i) ) }}</option>
@endfor
</select>
</div>
<div class="col-md-4">
<select name="day-end" id="day-end" class="custom-select" required autofocus>
@for ($i = date('Y'); $i < date('Y') + 20; $i++)
<option value="{{ $i }}">{{ $i }}</option>
@endfor
</select>
</div>
</div>
</div>
<div class="form-group row">
<button class="btn btn-primary mx-auto" type="submit">Submit form</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
......@@ -5,8 +5,7 @@
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Dashboard') }}</div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
......@@ -14,7 +13,7 @@
</div>
@endif
{{ __('You are logged in!') }}
Bienvenue sur ma page d'accueil.
</div>
</div>
</div>
......
......@@ -33,7 +33,9 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<!-- Left Side Of Navbar -->
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="{{ url('/form') }}">{{ __('Créer un tournoi') }}</a>
</li>
</ul>
<!-- Right Side Of Navbar -->
......
......@@ -16,15 +16,19 @@ use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return view('home');
});
Route::get('/template', function () {
return view('main');
});
/*
Route::get('/vue2', 'MonControleur@index');
Route::get('/{firstname}/{name}', function ($firstname, $name) {
return "Koukou $firstname $name";
});
*/
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::get('/form', 'TournamentController@index');
//Routes de test
Route::get('/formtest', 'TournamentController@createTournament');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment