I am creating an enrollment system that should generate an unique student id upon submitting a form. The unique id is not included in the form field. Rather it will be generated using the sotore method in the StudentController class. Please refer to my code below.
class StudentController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function store(StudentRequest $request)
{
$student = Student::create($request->all());
$student->id_no = "12345669";
$student->save();
return redirect('index');
}
}
As shown above I want to create the student id. Can someone please suggest best practices of doing such this.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire