First of all, Everything is kind of confusing. There is a few tutorials and complete documentation but i feel like something is just not working way it should. For now I'm a little bit confused and discouraged. I learned how to write forms, how to make views with blade. How to menage migrations and even seeds. I know how to create new controller and simple routes.
But guys... I need some advice if you would answer...
I created a form with a view for example that form:
{{Form::open(array('url' => 'person/confirm'))}}
{{Form::label('firstname', 'Firstname:')}}
{{Form::text('firstname')}}
{{Form::label('lastname', 'Lastname:')}}
{{Form::text('lastname')}}
{{Form::label('company_name', 'Company name:')}}
{{Form::text('company_name')}}
{{Form::label('mail', 'Mail:')}}
{{Form::text('mail')}}
{{Form::label('phone', 'Phone:')}}
{{Form::text('phone')}}
{{Form::label('additional_phone', 'Additional phone:')}}
{{Form::text('additional_phone')}}
{{Form::label('city', 'City:')}}
{{Form::text('city')}}
{{Form::label('postalcode', 'Postalcode:')}}
{{Form::text('postalcode')}}
{{Form::label('address', 'Address:')}}
{{Form::text('address')}}
{{Form::label('notes', 'Notes:')}}
{{Form::text('notes')}}
{{Form::submit('Submit')}}
{{Form::close()}}
Nothing fancy, just a basic form. If I call submit, it will take me to person/confirm route. And it will be like this:
Route::post('person/confirm', function(){
$input = Input::all();
DB::table('humanity')->insert(
array('firstname' => $firstname);
);
}
I know that it is wrong.
How to get values from $input?
How to insert it to table correctly and safely?
Where is the best place to make query call?
It will be better to make query before routing starts or when next route will execute?
It would be good to create query in controller function and execute it in route then redirect to "message: Success"?
What exactly are classes and models and how can I use them?
I plan to write some system and day by day it makes me more sicker than satisfied. Something call me that I had hitched my wagon to a star.
Thank you in advice.