<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;


use App\Http\Requests;
use App\AlumnosAdmision;
use App\Http\Controllers\Controller;

class CredencialesController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return Response
     */
    public function index()
    {
        //
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return Response
     */
    public function create()
    {
        $a = AlumnosAdmision::where('folio', '=', session('folio'))->first();
        
        if ($a->talla==null) { 
            return view('credenciales.talla')->with("alumno", $a);    
        } else {
            return view('credenciales.principal')->with("alumno", $a);    
        }
        
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  Request  $request
     * @return Response
     */
    public function store(Request $request)
    {
        $data = $request->all();

        $a = AlumnosAdmision::where('folio', '=', session('folio'))->first();
        $a->talla = $data['talla'];
        $a->save();

        echo "<label>Tu talla se ha registrado de manera exitosa.</label><br>";

        return view('credenciales.principal')->with("alumno", $a);    
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  Request  $request
     * @param  int  $id
     * @return Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return Response
     */
    public function destroy($id)
    {
        //
    }
}
