Ekapp/skolehjem/app/Http/Controllers/AllowActionController.php

27 lines
839 B
PHP

<?php
namespace App\Http\Controllers;
use App\AllowAction;
use Illuminate\Http\Request;
class AllowActionController extends Controller
{
/*We use $request to get the data from the HTMl pages*/
function AllowActionRegistering(Request $request) {
/*
Here we use our model AllowAction and the Laravel function "find",
in the "find" functions parameter we pass "$request->id" to find out what
number the it contains.
*/
$action = AllowAction::find($request->id);
/*Call the Laravel "update" function to update number in the database
If the allow column in the database is equal to 1 there is open for registration
If the allow column is equal to 0 there is closed for registration
*/
$action->update([ 'allow' => $request->allow ]);
}
}