Skip to content

Instantly share code, notes, and snippets.

@nickels
Created August 17, 2017 06:02
Show Gist options
  • Select an option

  • Save nickels/56f3df5adf836786d47600f543564bd9 to your computer and use it in GitHub Desktop.

Select an option

Save nickels/56f3df5adf836786d47600f543564bd9 to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Support\Facades\Auth;
use App\Http\Controllers\Controller;
class SomeController extends Controller
{
public function store()
{
$timesheet = request()->validate([
'date' => ['required', 'date', 'before_or_equal:' . \Carbon\Carbon::today()],
'records.*.project_id' => request()->sanitize('project_id', function ($projectId) {
// ?
}),
]);
Auth::user()->timesheet()->save($timesheet);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment