Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required||max:255', 'description' => 'required||max:255']);
     $template = Template::create(['name' => $request->name, 'description' => $request->description, 'user_id' => $request->user]);
     // dd($request);
     return redirect('/admin/templates');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //return 'form posted';
     $rules = array('template_name' => 'required', 'template_subject' => 'required', 'template_content' => 'required');
     $validator = \Validator::make(\Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('admin/templates/create')->withInput()->witherrors($validator->messages());
     }
     $template = Template::create(array('template_name' => \Input::get('template_name'), 'template_subject' => \Input::get('template_subject'), 'template_content' => \Input::get('template_content')));
     return \Redirect::to('admin/templates');
 }
Ejemplo n.º 3
0
 public function run()
 {
     DB::table('templates')->delete();
     Template::create(['name' => 'Soft Colors Template', 'alias' => 'soft', 'description' => 'A template with soft colors to soothe the soul.', 'active_state' => false, 'css_content' => 'body{ background-color: beige;}', 'created_by' => 1, 'modified_by' => 1]);
     Template::create(['name' => 'Other Colors Template', 'alias' => 'other', 'description' => 'A template with other colors to soothe the soul.', 'active_state' => true, 'css_content' => 'body{ background-color: e0eeee; } #Header h1{color: #ffa500} #Footer h1{color: #450b00} #Main h1{color: #00ced1}', 'created_by' => 1, 'modified_by' => 1]);
 }
Ejemplo n.º 4
0
 public function run()
 {
     DB::table('products')->delete();
     Template::create(['style_name' => 'Авто', 'height' => '348', 'width' => '606', 'offset' => '25', 'code_face' => '{"data_id":"45326446","data_value":"E-mail: xxxxx@xxxx.xx","style":"color: rgb(0, 0, 0); font-size: 20px; left: 356px; top: 272px;","styleImg":"color: rgb(0, 0, 0); font-size: 20px; left: 356px; top: 272px;"}|||{"data_id":"29932038","data_value":"моб.: (ххх) ххх-хх-хх","style":"color: rgb(0, 0, 0); font-size: 20px; left: 371px; top: 242px;","styleImg":"color: rgb(0, 0, 0); font-size: 20px; left: 371px; top: 242px;"}|||{"data_id":"15987516","data_value":"Тел.факс: (ххх) ххх-хх-хх","style":"color: rgb(0, 0, 0); font-size: 20px; left: 326px; top: 211px;","styleImg":"color: rgb(0, 0, 0); font-size: 20px; left: 326px; top: 211px;"}|||{"data_id":"22169546","data_value":"Улица, дом","style":"color: rgb(0, 0, 0); font-size: 18px; left: 453px; top: 183px;","styleImg":"color: rgb(0, 0, 0); font-size: 18px; left: 453px; top: 183px;"}|||{"data_id":"45948140","data_value":"Страна, г. Город","style":"color: rgb(0, 0, 0); left: 409px; top: 161px; font-size: 18px;","styleImg":"color: rgb(0, 0, 0); left: 409px; top: 161px; font-size: 18px;"}|||{"data_id":"99653617","data_vis":false,"data_value":"должность","style":"color: rgb(0, 0, 0); left: 471px; top: 127px;","styleImg":"color: rgb(0, 0, 0); left: 471px; top: 127px;"}|||{"data_id":"11236042","data_value":"Имя Отчество","style":"font-size: 20px; color: rgb(255, 255, 255); left: 417px; top: 103px;","styleImg":"font-size: 20px; color: rgb(255, 255, 255); left: 417px; top: 103px;"}|||{"data_id":"5916004","data_value":"Фамилия","style":"font-size: 28px; color: rgb(255, 255, 255); left: 419px; top: 67px; font-weight: bold;","styleImg":"font-size: 28px; color: rgb(255, 255, 255); left: 419px; top: 67px; font-weight: bold;"}|||{"data_id":"40267012","data_value":"услуги","style":"color: rgb(0, 0, 0); left: 504px; top: 20px;","styleImg":"color: rgb(0, 0, 0); left: 504px; top: 20px;"}|||{"data_id":"63309878","data_value":"Название","style":"color: rgb(0, 0, 0); font-size: 20px; left: 462px; top: 0px;","styleImg":"color: rgb(0, 0, 0); font-size: 20px; left: 462px; top: 0px;"}|||{"data_id":"370647","data_name":"9b3f0c35fc9b8eifj4rf4uf49rfj4f8c8ea78.jpg","data_type":true,"styleImg":"position: absolute; top: -112px; left: -295px; width: 906.7707641196013px; height: 570px;"}|||11|||"rgb(255, 255, 255)"', 'code_back' => '{"data_id":"45326446","data_value":"E-mail: xxxxx@xxxx.xx","style":"color: rgb(0, 0, 0); font-size: 20px; left: 356px; top: 272px;","styleImg":"color: rgb(0, 0, 0); font-size: 20px; left: 356px; top: 272px;"}|||{"data_id":"29932038","data_value":"моб.: (ххх) ххх-хх-хх","style":"color: rgb(0, 0, 0); font-size: 20px; left: 371px; top: 242px;","styleImg":"color: rgb(0, 0, 0); font-size: 20px; left: 371px; top: 242px;"}|||{"data_id":"15987516","data_value":"Тел.факс: (ххх) ххх-хх-хх","style":"color: rgb(0, 0, 0); font-size: 20px; left: 326px; top: 211px;","styleImg":"color: rgb(0, 0, 0); font-size: 20px; left: 326px; top: 211px;"}|||{"data_id":"22169546","data_value":"Улица, дом","style":"color: rgb(0, 0, 0); font-size: 18px; left: 453px; top: 183px;","styleImg":"color: rgb(0, 0, 0); font-size: 18px; left: 453px; top: 183px;"}|||{"data_id":"45948140","data_value":"Страна, г. Город","style":"color: rgb(0, 0, 0); left: 409px; top: 161px; font-size: 18px;","styleImg":"color: rgb(0, 0, 0); left: 409px; top: 161px; font-size: 18px;"}|||{"data_id":"99653617","data_vis":false,"data_value":"должность","style":"color: rgb(0, 0, 0); left: 471px; top: 127px;","styleImg":"color: rgb(0, 0, 0); left: 471px; top: 127px;"}|||{"data_id":"11236042","data_value":"Имя Отчество","style":"font-size: 20px; color: rgb(255, 255, 255); left: 417px; top: 103px;","styleImg":"font-size: 20px; color: rgb(255, 255, 255); left: 417px; top: 103px;"}|||{"data_id":"5916004","data_value":"Фамилия","style":"font-size: 28px; color: rgb(255, 255, 255); left: 419px; top: 67px; font-weight: bold;","styleImg":"font-size: 28px; color: rgb(255, 255, 255); left: 419px; top: 67px; font-weight: bold;"}|||{"data_id":"40267012","data_value":"услуги","style":"color: rgb(0, 0, 0); left: 504px; top: 20px;","styleImg":"color: rgb(0, 0, 0); left: 504px; top: 20px;"}|||{"data_id":"63309878","data_value":"Название","style":"color: rgb(0, 0, 0); font-size: 20px; left: 462px; top: 0px;","styleImg":"color: rgb(0, 0, 0); font-size: 20px; left: 462px; top: 0px;"}|||{"data_id":"370647","data_name":"9b3f0c35fc9b8eifj4rf4uf49rfj4f8c8ea78.jpg","data_type":true,"styleImg":"position: absolute; top: -112px; left: -295px; width: 906.7707641196013px; height: 570px;"}|||11|||"rgb(255, 255, 255)"', 'preview' => 'template_1.png', 'active' => 1]);
     Template::create(['style_name' => 'Абстрактные', 'height' => '348', 'width' => '606', 'offset' => '25', 'code_face' => '{"data_id":"28443115","data_name":"1545761cf57cc2.jpeg","data_type":true,"styleImg":"left: 1px; top: 1px; position: absolute; width: 627.407407407407px; height: 350px;"}|||{"data_id":"45326446","data_value":"E-mail: xxxxx@xxxx.xx","style":"color: rgb(247, 242, 247); font-size: 20px; left: 338px; top: 267px;","styleImg":"color: rgb(247, 242, 247); font-size: 20px; left: 338px; top: 267px;"}|||{"data_id":"29932038","data_value":"моб.: (ххх) ххх-хх-хх","style":"color: rgb(240, 231, 240); font-size: 20px; left: 357px; top: 240px;","styleImg":"color: rgb(240, 231, 240); font-size: 20px; left: 357px; top: 240px;"}|||{"data_id":"15987516","data_value":"Тел.факс: (ххх) ххх-хх-хх","style":"color: rgb(250, 250, 250); font-size: 20px; left: 312px; top: 213px;","styleImg":"color: rgb(250, 250, 250); font-size: 20px; left: 312px; top: 213px;"}|||{"data_id":"22169546","data_value":"Улица, дом","style":"color: rgb(245, 240, 245); font-size: 18px; left: 447px; top: 187px;","styleImg":"color: rgb(245, 240, 245); font-size: 18px; left: 447px; top: 187px;"}|||{"data_id":"45948140","data_value":"Страна, г. Город","style":"color: rgb(245, 233, 245); left: 404px; top: 157px; font-size: 18px;","styleImg":"color: rgb(245, 233, 245); left: 404px; top: 157px; font-size: 18px;"}|||{"data_id":"99653617","data_value":"должность","style":"color: rgb(245, 237, 245); left: 462px; top: 104px;","styleImg":"color: rgb(245, 237, 245); left: 462px; top: 104px;"}|||{"data_id":"11236042","data_value":"Имя Отчество","style":"font-size: 20px; color: rgb(255, 255, 255); left: 407px; top: 82px;","styleImg":"font-size: 20px; color: rgb(255, 255, 255); left: 407px; top: 82px;"}|||{"data_id":"5916004","data_value":"Фамилия","style":"font-size: 28px; color: rgb(245, 237, 245); left: 410px; top: 48px; font-weight: bold; font-family: Arial;","styleImg":"font-size: 28px; color: rgb(245, 237, 245); left: 410px; top: 48px; font-weight: bold; font-family: Arial;"}|||{"data_id":"40267012","data_value":"услуги","style":"color: rgb(245, 233, 245); left: 494px; top: 28px;","styleImg":"color: rgb(245, 233, 245); left: 494px; top: 28px;"}|||{"data_id":"63309878","data_value":"Название","style":"color: rgb(245, 242, 245); font-size: 20px; left: 452px; top: 2px;","styleImg":"color: rgb(245, 242, 245); font-size: 20px; left: 452px; top: 2px;"}|||11|||"rgb(255, 255, 255)"', 'code_back' => '', 'preview' => '8dd153adbc08.png', 'active' => 1]);
     Template::create(['style_name' => 'Абстрактные', 'height' => '348', 'width' => '606', 'offset' => '25', 'code_face' => '{"data_id":"39834242","data_name":"15457d70dcd5ef.jpeg","data_type":true,"styleImg":"position: absolute; top: 0px; left: -17px; width: 625.614814814815px; height: 349px;"}|||{"data_id":"45326446","data_value":"E-mail: xxxxx@xxxx.xx","style":"color: rgb(0, 0, 0); font-size: 20px; left: 196px; top: 270px;","styleImg":"color: rgb(0, 0, 0); font-size: 20px; left: 196px; top: 270px;"}|||{"data_id":"29932038","data_value":"моб.: (ххх) ххх-хх-хх","style":"color: rgb(0, 0, 0); font-size: 20px; left: 4px; top: 269px;","styleImg":"color: rgb(0, 0, 0); font-size: 20px; left: 4px; top: 269px;"}|||{"data_id":"15987516","data_value":"Тел.факс: (ххх) ххх-хх-хх","style":"color: rgb(0, 0, 0); font-size: 20px; left: 1px; top: 245px;","styleImg":"color: rgb(0, 0, 0); font-size: 20px; left: 1px; top: 245px;"}|||{"data_id":"22169546","data_value":"Улица, дом","style":"color: rgb(0, 0, 0); font-size: 18px; left: 164px; top: 218px;","styleImg":"color: rgb(0, 0, 0); font-size: 18px; left: 164px; top: 218px;"}|||{"data_id":"45948140","data_value":"Страна, г. Город","style":"color: rgb(0, 0, 0); left: 0px; top: 219px; font-size: 18px;","styleImg":"color: rgb(0, 0, 0); left: 0px; top: 219px; font-size: 18px;"}|||{"data_id":"99653617","data_value":"должность","style":"color: rgb(0, 0, 0); left: 234px; top: 164px;","styleImg":"color: rgb(0, 0, 0); left: 234px; top: 164px;"}|||{"data_id":"11236042","data_value":"Имя Отчество","style":"font-size: 20px; color: rgb(0, 0, 0); left: 214px; top: 134px;","styleImg":"font-size: 20px; color: rgb(0, 0, 0); left: 214px; top: 134px;"}|||{"data_id":"5916004","data_value":"Фамилия","style":"font-size: 28px; color: rgb(0, 0, 0); left: 212px; top: 99px; font-weight: bold; font-family: Arial;","styleImg":"font-size: 28px; color: rgb(0, 0, 0); left: 212px; top: 99px; font-weight: bold; font-family: Arial;"}|||{"data_id":"40267012","data_value":"услуги","style":"color: rgb(0, 0, 0); left: 238px; top: 24px;","styleImg":"color: rgb(0, 0, 0); left: 238px; top: 24px;"}|||{"data_id":"63309878","data_value":"Название","style":"color: rgb(0, 0, 0); font-size: 20px; left: 218px; top: 2px;","styleImg":"color: rgb(0, 0, 0); font-size: 20px; left: 218px; top: 2px;"}|||11|||"rgb(255, 255, 255)"', 'code_back' => '', 'preview' => '7ed916601172.png', 'active' => 1]);
 }
Ejemplo n.º 5
0
    }
    $variableMapping = ['/\\%CHI_NAME\\%/' => "chinese_name", '/\\%ENG_NAME\\%/' => "english_name", '/\\%TODAY\\%/' => "today", '/\\%LOGIN\\%/' => "loginname", '/\\%PASSWORD\\%/' => "password"];
    $template = \App\Template::firstOrFail()->template;
    $letters = [];
    foreach ($customers as $user) {
        $letter = $template;
        foreach ($variableMapping as $pattern => $variable) {
            if ($pattern == '/\\%TODAY\\%/') {
                $today = \Carbon\Carbon::create()->toDateString();
                $letter = preg_replace($pattern, $today, $letter);
            } else {
                $letter = preg_replace($pattern, $user->{$variable}, $letter);
            }
        }
        $letters[] = $letter;
    }
    return view('print.accountInitLetter', compact('letters'));
});
Route::get('/template/create', function () {
    $template = \App\Template::first();
    return view('print.createTemplate', compact('template'));
});
Route::put('/template/update', function (\Illuminate\Http\Request $request) {
    $template = \App\Template::firstOrFail();
    $template->update($request->all());
    return view('print.createTemplate', compact('template'));
});
Route::post('/template/create', function (\Illuminate\Http\Request $request) {
    \App\Template::create($request->all());
    return view('print.accountInitLetter', compact('text'));
});
Ejemplo n.º 6
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(TemplateRequest $request)
 {
     $input = $request->all();
     $sectionNameAmount = count($input['section_name']);
     $sectionDisplayNameAmount = count($input['section_display_name']);
     $sectionDescriptionAmount = count($input['section_description']);
     $sectionEditableAmount = count($input['section_editable']);
     $sectionContentAmount = count($input['section_content']);
     if ($sectionNameAmount != $sectionDisplayNameAmount || $sectionNameAmount != $sectionDescriptionAmount || $sectionNameAmount != $sectionEditableAmount || $sectionNameAmount != $sectionContentAmount) {
         dd('error.');
     }
     $newTemplate = array('name' => $input['template_name'], 'display_name' => $input['template_display_name'], 'description' => $input['template_description'], 'category_id' => $input['template_category']);
     $template = Template::create($newTemplate);
     for ($i = 0; $i < $sectionNameAmount; $i++) {
         if ($input['section_name'][$i]) {
             $newTemplateSection = array('name' => $input['section_name'][$i], 'display_name' => $input['section_display_name'][$i], 'description' => $input['section_description'][$i], 'content' => $input['section_content'][$i], 'is_editable' => $input['section_editable'][$i], 'template_id' => $template->id);
             TemplateSection::create($newTemplateSection);
         }
     }
     return redirect('home/template');
 }