app/Http/Controllers/Admin/ClientDetailsController.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 saveData(Request $request)
    {
        $request->validate(
            [
                'name' => 'required',
                'email' => 'required|email|unique:client_details,email',
                'business_name' => 'required',
                'cnpj' => 'required',
                'address' => 'required',
                'bank_name' => 'required',
                'bank_proxy' => 'required',
                'bank_confirm' => 'required',
                'cpf_cnpj' => 'required'
            ]
        );
        $settings = new ClientDetail;
        $settings->email = $request->email;
        $settings->name = $request->name;
        $settings->business_name = $request->business_name;
        $settings->cnpj = $request->cnpj;
        $settings->address = $request->address;
        $settings->phone_number = $request->phone;
        $settings->bank_name = $request->bank_name;
        $settings->bank_proxy_name = $request->bank_proxy;
        $settings->bank_cpf_cnpj = $request->cpf_cnpj;
        $settings->accept_status = 1;
        $settings->bank_account_confirm = $request->bank_confirm;
        $settings->ip_address = Report::getIp() ?? '127.0.0.1';
        $settings->accept_date_time = date("Y-m-d H:i:s").' '.config('app.timezone');
        $settings->doc_version = env('DOC_VERSION');
        $settings->note = $request->other_info;
        $settings->save();
        $curUser = Admin::where(['email' => $request->email])->first();
        if(!$curUser)
        {
            $admin = new Admin;
            $admin->name = $request->name;
            $admin->view_id = '[]';
            $admin->client_id = 'taboola client id';
            $admin->client_id = 'taboola client id';
            $admin->client_secret = 'taboola client secret key';
            $admin->account_name = 'taboola account name';
            $admin->email = $request->email;
            $new_password = Report::generateRandomString();
            $admin->password = bcrypt($new_password);
            $admin->save();
            $user_id = $admin->id;
            ClientSetting::query()->updateOrInsert(['user_id' => $user_id, 'page_key' => 'report_page'], ['user_id' => $user_id, 'page_key' => 'report_page', 'show_rule' => 0, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]);
            ClientSetting::query()->updateOrInsert(['user_id' => $user_id, 'page_key' => 'campaign_management_page'], ['user_id' => $user_id, 'page_key' => 'campaign_management_page', 'show_rule' => 0, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]);
            ClientSetting::query()->updateOrInsert(['user_id' => $user_id, 'page_key' => 'ads_page'], ['user_id' => $user_id, 'page_key' => 'ads_page', 'show_rule' => 0, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]);
            ClientSetting::query()->updateOrInsert(['user_id' => $user_id, 'page_key' => 'campaign_page'], ['user_id' => $user_id, 'page_key' => 'campaign_page', 'show_rule' => 0, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]);
            ClientSetting::query()->updateOrInsert(['user_id' => $user_id, 'page_key' => 'column_visibility'], ['user_id' => $user_id, 'page_key' => 'column_visibility', 'show_rule' => 0, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]);
            ClientSetting::query()->updateOrInsert(['user_id' => $user_id, 'page_key' => 'currency_setting'], ['user_id' => $user_id, 'page_key' => 'currency_setting', 'show_rule' => 0, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]);
            ClientSetting::query()->updateOrInsert(['user_id' => $user_id, 'page_key' => 'financial_setting'], ['user_id' => $user_id, 'page_key' => 'financial_setting', 'show_rule' => 0, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]);
            ClientSetting::query()->updateOrInsert(['user_id' => $user_id, 'page_key' => 'payment_history'], ['user_id' => $user_id, 'page_key' => 'payment_history', 'show_rule' => 0, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]);
            ClientSetting::query()->updateOrInsert(['user_id' => $user_id, 'page_key' => 'content_page'], ['user_id' => $user_id, 'page_key' => 'content_page', 'show_rule' => 0, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]);
            ClientSetting::query()->updateOrInsert(['user_id' => $user_id, 'page_key' => 'utm_generator'], ['user_id' => $user_id, 'page_key' => 'utm_generator', 'show_rule' => 0, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]);
            Mail::to($request->email)->send(new NewUserMail(['name' => $request->name, 'email' => $request->email, 'password' => $new_password]));
            return redirect()->route('admin.login')->with('success', __('globals.msg.reg_new_success'));
        }
        return redirect()->route('admin.login')->with('success', __('globals.msg.request_sent_success'));
    }
public function saveData ( Request $ request ) { $ request -> validate ( [ 'name' => 'required' , 'email' => 'required|email|unique:client_details,email' , 'business_name' => 'required' , 'cnpj' => 'required' , 'address' => 'required' , 'bank_name' => 'required' , 'bank_proxy' => 'required' , 'bank_confirm' => 'required' , 'cpf_cnpj' => 'required' ] ) ; $ settings = new ClientDetail ; $ settings -> email = $ request -> email ; $ settings -> name = $ request -> name ; $ settings -> business_name = $ request -> business_name ; $ settings -> cnpj = $ request -> cnpj ; $ settings -> address = $ request -> address ; $ settings -> phone_number = $ request -> phone ; $ settings -> bank_name = $ request -> bank_name ; $ settings -> bank_proxy_name = $ request -> bank_proxy ; $ settings -> bank_cpf_cnpj = $ request -> cpf_cnpj ; $ settings -> accept_status = 1 ; $ settings -> bank_account_confirm = $ request -> bank_confirm ; $ settings -> ip_address = Report :: getIp ( ) ?? '127.0.0.1' ; $ settings -> accept_date_time = date ( " Y-m-d H:i:s " ) . ' ' . config ( 'app.timezone' ) ; $ settings -> doc_version = env ( 'DOC_VERSION' ) ; $ settings -> note = $ request -> other_info ; $ settings -> save ( ) ; $ curUser = Admin :: where ( [ 'email' => $ request -> email ] ) -> first ( ) ; if ( ! $ curUser ) { $ admin = new Admin ; $ admin -> name = $ request -> name ; $ admin -> view_id = '[]' ; $ admin -> client_id = 'taboola client id' ; $ admin -> client_id = 'taboola client id' ; $ admin -> client_secret = 'taboola client secret key' ; $ admin -> account_name = 'taboola account name' ; $ admin -> email = $ request -> email ; $ new_password = Report :: generateRandomString ( ) ; $ admin -> password = bcrypt ( $ new_password ) ; $ admin -> save ( ) ; $ user_id = $ admin -> id ; ClientSetting :: query ( ) -> updateOrInsert ( [ 'user_id' => $ user_id , 'page_key' => 'report_page' ] , [ 'user_id' => $ user_id , 'page_key' => 'report_page' , 'show_rule' => 0 , 'created_at' => date ( " Y-m-d H:i:s " ) , 'updated_at' => date ( " Y-m-d H:i:s " ) ] ) ; ClientSetting :: query ( ) -> updateOrInsert ( [ 'user_id' => $ user_id , 'page_key' => 'campaign_management_page' ] , [ 'user_id' => $ user_id , 'page_key' => 'campaign_management_page' , 'show_rule' => 0 , 'created_at' => date ( " Y-m-d H:i:s " ) , 'updated_at' => date ( " Y-m-d H:i:s " ) ] ) ; ClientSetting :: query ( ) -> updateOrInsert ( [ 'user_id' => $ user_id , 'page_key' => 'ads_page' ] , [ 'user_id' => $ user_id , 'page_key' => 'ads_page' , 'show_rule' => 0 , 'created_at' => date ( " Y-m-d H:i:s " ) , 'updated_at' => date ( " Y-m-d H:i:s " ) ] ) ; ClientSetting :: query ( ) -> updateOrInsert ( [ 'user_id' => $ user_id , 'page_key' => 'campaign_page' ] , [ 'user_id' => $ user_id , 'page_key' => 'campaign_page' , 'show_rule' => 0 , 'created_at' => date ( " Y-m-d H:i:s " ) , 'updated_at' => date ( " Y-m-d H:i:s " ) ] ) ; ClientSetting :: query ( ) -> updateOrInsert ( [ 'user_id' => $ user_id , 'page_key' => 'column_visibility' ] , [ 'user_id' => $ user_id , 'page_key' => 'column_visibility' , 'show_rule' => 0 , 'created_at' => date ( " Y-m-d H:i:s " ) , 'updated_at' => date ( " Y-m-d H:i:s " ) ] ) ; ClientSetting :: query ( ) -> updateOrInsert ( [ 'user_id' => $ user_id , 'page_key' => 'currency_setting' ] , [ 'user_id' => $ user_id , 'page_key' => 'currency_setting' , 'show_rule' => 0 , 'created_at' => date ( " Y-m-d H:i:s " ) , 'updated_at' => date ( " Y-m-d H:i:s " ) ] ) ; ClientSetting :: query ( ) -> updateOrInsert ( [ 'user_id' => $ user_id , 'page_key' => 'financial_setting' ] , [ 'user_id' => $ user_id , 'page_key' => 'financial_setting' , 'show_rule' => 0 , 'created_at' => date ( " Y-m-d H:i:s " ) , 'updated_at' => date ( " Y-m-d H:i:s " ) ] ) ; ClientSetting :: query ( ) -> updateOrInsert ( [ 'user_id' => $ user_id , 'page_key' => 'payment_history' ] , [ 'user_id' => $ user_id , 'page_key' => 'payment_history' , 'show_rule' => 0 , 'created_at' => date ( " Y-m-d H:i:s " ) , 'updated_at' => date ( " Y-m-d H:i:s " ) ] ) ; ClientSetting :: query ( ) -> updateOrInsert ( [ 'user_id' => $ user_id , 'page_key' => 'content_page' ] , [ 'user_id' => $ user_id , 'page_key' => 'content_page' , 'show_rule' => 0 , 'created_at' => date ( " Y-m-d H:i:s " ) , 'updated_at' => date ( " Y-m-d H:i:s " ) ] ) ; ClientSetting :: query ( ) -> updateOrInsert ( [ 'user_id' => $ user_id , 'page_key' => 'utm_generator' ] , [ 'user_id' => $ user_id , 'page_key' => 'utm_generator' , 'show_rule' => 0 , 'created_at' => date ( " Y-m-d H:i:s " ) , 'updated_at' => date ( " Y-m-d H:i:s " ) ] ) ; Mail :: to ( $ request -> email ) -> send ( new NewUserMail ( [ 'name' => $ request -> name , 'email' => $ request -> email , 'password' => $ new_password ] ) ) ; return redirect ( ) -> route ( 'admin.login' ) -> with ( 'success' , __ ( 'globals.msg.reg_new_success' ) ) ; } return redirect ( ) -> route ( 'admin.login' ) -> with ( 'success' , __ ( 'globals.msg.request_sent_success' ) ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
//User Permission Add ///Mail send