Ok i have something now: I created a middleware:
public function handle($request, Closure $next)
{
$time = (now()->format('H:i'));
$day = date("Y-m-d");
$number = date('N', strtotime($day));
if(auth()->posts()->monday <> $day){
deny acces to table 'body';
}
else{
...
}
return $next($request);
}
And the middleware runs only if we visit the post page. What I didn't find was how to deny access to this one table called "body" from the database.
And how do I check this for every day? Do I go on with ifelse...... or is there a better method?
Also, I don't know if I can access the table like that
auth()->posts()->monday
My post table looks something like this
$post->monday = $request->has('monday') ? 1 : 0;
$post->tuesday = $request->has('tuesday') ? 2 : 0;
$post->wednesday = $request->has('wednesday') ? 3 : 0;
$post->thursday = $request->has('thursday') ? 4 : 0;
$post->friday = $request->has('friday') ? 5 : 0;
$post->saturday = $request->has('saturday') ? 6 : 0;
$post->sunday = $request->has('sunday') ? 7 : 0;