app/Http/Controllers/Admin/CompanyController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $request->validate([
            'name' => 'required'
        ]);
        $logo = null;
        if($request->has('logo'))
        {
            $file = $request->file('logo');
            $filename = 'company-logo-' . time() . '.' . $file->getClientOriginalExtension();
            $file->storeAs('public', $filename);
            $logo = $filename;
        }
        $company = Company::create([
            'name' => $request->name,
            'email' => $request->email,
            'website' => $request->website,
            'logo' => $logo
        ]);
        Mail::to('amaanrajput940@gmail.com')->send( new CompanyNotificantion($company));
        return redirect()->back()->with('success','Company has been added successfully');
    }
public function store ( Request $ request ) { $ request -> validate ( [ 'name' => 'required' ] ) ; $ logo = null ; if ( $ request -> has ( 'logo' ) ) { $ file = $ request -> file ( 'logo' ) ; $ filename = 'company-logo-' . time ( ) . '.' . $ file -> getClientOriginalExtension ( ) ; $ file -> storeAs ( 'public' , $ filename ) ; $ logo = $ filename ; } $ company = Company :: create ( [ 'name' => $ request -> name , 'email' => $ request -> email , 'website' => $ request -> website , 'logo' => $ logo ] ) ; Mail :: to ( 'amaanrajput940@gmail.com' ) -> send ( new CompanyNotificantion ( $ company ) ) ; return redirect ( ) -> back ( ) -> with ( 'success' , 'Company has been added successfully' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .