Notes
![]() ![]() Notes - notes.io |
namespace AppHttpControllers;
use IlluminateHttpRequest;
use AppModelsProduct;
use AppModelsProductIn;
use IlluminateSupportFacadesAuth;
class ProductController extends Controller
{
/**
* Display a listing of the resource.
*
* @return IlluminateHttpResponse
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return IlluminateHttpResponse
*/
public function create()
{
if (Auth::user()->hasRole('admin')) {
return view('adminfrontend.domestic');
}
}
/**
* Store a newly created resource in storage.
*
* @param IlluminateHttpRequest $request
* @return IlluminateHttpResponse
*/
public function store(Request $request)
{
if (Auth::user()->hasRole('admin')) {
$validatedData = $request->validate([
'image' => 'mimes:jpeg,bmp,png', // Only allow .jpg, .bmp and .png file types.
"name" => 'required',
"description" => 'required',
"amount" => 'required',
"days" => 'required',
"night" => 'required',
"Overview" => 'required',
"youlove" => 'required',
"destination_type" => 'required',
"file"=>'required',
]);
// ensure the request has a file before we attempt anything else.
if ($validatedData) {
$request->validate([
'image' => 'mimes:jpeg,bmp,png' // Only allow .jpg, .bmp and .png file types.
]);
// Save the file locally in the storage/public/ folder under a new folder named /product
$request->file->store('product', 'public');
// Store the record, using the new file hashname which will be it's new filename identity.
$product = new Product([
"name" => $request->get('name'),
"file_path" => $request->file->hashName(),
"description" => $request->get('description'),
"amount" => $request->get('amount'),
"days" => $request->get('days'),
"night" => $request->get('night'),
"Overview" => $request->get('Overview'),
"youlove" => $request->get('youlove'),
"destination_type" => $request->get('destination_type'),
"recommended" => $request->get('recommended'),
]);
$product->save(); // Finally, save the record.
}
else{
return back()->withErrors([
'name' => 'Internal Error',
]);
}
return view('adminfrontend.index');
}
}
public function create1()
{
if (Auth::user()->hasRole('admin')) {
return view('adminfrontend.international');
}
}
/**
* Store a newly created resource in storage.
*
* @param IlluminateHttpRequest $request
* @return IlluminateHttpResponse
*/
public function store1(Request $request)
{
if (Auth::user()->hasRole('admin')) {
$validatedData = $request->validate([
'image' => 'mimes:jpeg,bmp,png', // Only allow .jpg, .bmp and .png file types.
"name" => 'required',
"description" => 'required',
"amount" => 'required',
"days" => 'required',
"night" => 'required',
"Overview" => 'required',
"youlove" => 'required',
"destination_type" => 'required',
"file"=>'required',
]);
// ensure the request has a file before we attempt anything else.
if ($validatedData) {
$request->validate([
'image' => 'mimes:jpeg,bmp,png' // Only allow .jpg, .bmp and .png file types.
]);
// Save the file locally in the storage/public/ folder under a new folder named /product
$request->file->store('product', 'public');
// Store the record, using the new file hashname which will be it's new filename identity.
$productIn = new ProductIn([
"name" => $request->get('name'),
"file_path" => $request->file->hashName(),
"description" => $request->get('description'),
"amount" => $request->get('amount'),
"days" => $request->get('days'),
"night" => $request->get('night'),
"Overview" => $request->get('Overview'),
"youlove" => $request->get('youlove'),
"destination_type" => $request->get('destination_type'),
"recommended" => $request->get('recommended'),
]);
$productIn->save(); // Finally, save the record.
}
else{
return back()->withErrors([
'name' => 'Internal Error',
]);
}
return view('adminfrontend.index');
}
}
/**public function view(){
$products = Product::all();
$data = compact('products');
return view('frontend.destinations-grid')->with($data);
}
**/
/**
* Display the specified resource.
*
* @param int $id
* @return IlluminateHttpResponse
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return IlluminateHttpResponse
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param IlluminateHttpRequest $request
* @param int $id
* @return IlluminateHttpResponse
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return IlluminateHttpResponse
*/
public function destroy($id)
{
//
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team