I have a question about routing. I make my menu as a database. Then when I click "job company" on my website, it gave me error Route [company.insert_logo] not defined. on my blade. I keep changing between my database and my blade but it doesn't work. I want to submit a form with image to the database. Below I attach my code
my company.blade.php
<form method="post" action="{{ route('company.insert_logo') }}" enctype="multipart/form-data">
@csrf
<div class="intro-y box p-5">
<div class="mt-3">
<label>Company</label>
<div class="mt-2">
<label class="input w-full border mt-2" align="right">Select Company Logo</label>
<div class="col-md-8">
<input type="file" name="company_logo" />
</div>
</div>
</div>
<div class="mt-3">
<label>Position Name</label>
<input type="text" class="input w-full border mt-2 form-control" name="company_name" placeholder="Company Name">
</div>
<div class="text-right mt-5">
<button type="button" class="button w-24 border dark:border-dark-5 text-gray-700 dark:text-gray-300 mr-1">Cancel</button>
<button type="submit" class="button w-24 bg-theme-1 text-white" name="store_company" >Save</button>
</div>
{{-- <input type="submit" name="store_image" class="btn btn-primary" value="Save" /> --}}
</div>
</form>
</div>
web.php
Route::resource('company', 'CompanyController');
I believe that I might write something wrong for my web.php but I am really not sure where.
Lets say I'm not using resource
web.php
Route::get('store_company', 'CompanyController@index');
Route::post('store_company/insert_logo', 'CompanyController@insert_logo');
Route::get('store_company/fetch_logo/{id}', 'StoreImageController@fetch_logo');
and I change my blade using URL instead of routing to
<form method="post" action="{{ url('store_company/insert_logo') }}" enctype="multipart/form-data">
I am still getting the same error which is routing for my company.index(inside my database menu) is undefined
'company.insert_logo'
is not one of them, you'd need to create a separate Named Route for thatSHOW CREATE TABLE
. Use\G
in themysql>
shell to keep it tidy.