Beispiel #1
0
 public function store(Request $request)
 {
     $keys = 'name,fid,logo_aid';
     $data = $this->autoValidate($request, 'brand.store', $keys);
     Brand::create($data);
     return $this->success('', url('admin/brand'));
 }
Beispiel #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $brand = Brand::create(['name' => 'Opel', 'code' => '']);
     BrandModel::create(['name' => 'Corsa', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'Vectra', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'Insignia', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'Astra', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'Mondeo', 'code' => '', 'brand_id' => $brand->id]);
     $brand = Brand::create(['name' => 'Audi', 'code' => '']);
     BrandModel::create(['name' => 'A1', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'A2', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'A3', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'A4', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'A5', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'TT', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'A6', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'A7', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'A8', 'code' => '', 'brand_id' => $brand->id]);
     $brand = Brand::create(['name' => 'Renault', 'code' => '']);
     BrandModel::create(['name' => 'Clio', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'Espace', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'Kangoo', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'Megane', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'Laguna', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'Modus', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'Fluence', 'code' => '', 'brand_id' => $brand->id]);
     BrandModel::create(['name' => 'Captur', 'code' => '', 'brand_id' => $brand->id]);
     $brand = Brand::create(['name' => 'Fiat', 'code' => '']);
     $brand = Brand::create(['name' => 'BMW', 'code' => '']);
     $brand = Brand::create(['name' => 'Seat', 'code' => '']);
 }
Beispiel #3
0
 public function add(Request $request)
 {
     //
     $this->validate($request, ['brand_name' => 'required']);
     $new_brand = ['brand_name' => $request->brand_name];
     $brand = Brand::create($new_brand);
     return response()->json($brand);
 }
Beispiel #4
0
 public function store(Request $request)
 {
     $keys = 'name,logo_aid';
     $data = $this->autoValidate($request, 'brand.store', $keys);
     $data += ['fid' => $this->factory->getKey()];
     Brand::create($data);
     return $this->success('', url('factory/brand'));
 }
 public function store(BrandFormRequest $request)
 {
     $page = 'partials.admin-addBrand';
     $users = User::all();
     $brand_name = $request->input('brand_name');
     $brand_type = $request->input('brand_type');
     Brand::create(['brand_name' => $brand_name, 'brand_type' => $brand_type]);
     return redirect()->route('admin.brandManagement');
 }
 public function store(BrandRequest $request)
 {
     $image_name = $request->input('name') . Carbon::now()->timestamp . "_" . $request->file('image')->getClientOriginalName();
     $request->file('image')->move(public_path() . '/images/brands/', $image_name);
     $data = $request->all();
     $data['image'] = $image_name;
     Brand::create($data);
     return redirect(url('brands'));
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('brands')->delete();
     Brand::create(array('brand_name' => 'iPhone'));
     Brand::create(array('brand_name' => 'SamSung'));
     Brand::create(array('brand_name' => 'Sony'));
     Brand::create(array('brand_name' => 'Oppo'));
     Brand::create(array('brand_name' => 'Nokia'));
 }
 public function store(BrandFormRequest $request)
 {
     $page = 'partials.admin-addBrand';
     $users = User::all();
     $brand_name = $request->input('brand_name');
     // Nhận các giá trị từ trang thêm sản phẩm
     $brand_type = $request->input('brand_type');
     // sử dụng lớp BrandFormRequest để kiểm tra các thông tin
     //Thêm mới sản phẩm vào bảng brands
     Brand::create(['brand_name' => $brand_name, 'brand_type' => $brand_type]);
     return redirect()->route('admin.brandManagement');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|max:255']);
     $input = $request->all();
     $input['branch_id'] = Auth::user()->branch_id;
     $input['company_id'] = Auth::user()->company_id;
     $input['user_id'] = Auth::user()->id;
     $input['account_year_id'] = session('account');
     Brand::create($input);
     flash()->success('Brand Created Successfully !');
     return redirect('brand');
 }
Beispiel #10
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, ['nama_brand' => 'required|max:200', 'image' => 'required|mimes:jpeg,bmp,png']);
     $data['nama_brand'] = $request->nama_brand;
     if ($request->hasFile('image')) {
         $data['logo_brand'] = $this->savePhoto($request->file('image'));
     }
     if (Brand::create($data)) {
         \Flash::success('Brand Berhasil Disimpan');
     } else {
         \Flash::info('Brand Gagal Disimpan');
     }
     return redirect('admin/brand');
 }
Beispiel #11
0
 /**
  * Store a newly created Cruiseline.
  *
  * @param Request $request
  * @param Cruiseline $brand
  * @return mixed
  */
 public function store(CreateBrand $request)
 {
     $brand = Brand::create($request->all());
     if ($request->hasFile('logo')) {
         if ($request->file('logo')->isValid()) {
             $logo = $request->file('logo');
             $moveLogo = $logo->move(public_path() . '/uploads', $filename = time() . '-' . $logo->getClientOriginalName());
             $brand->logo = $filename;
         } else {
             return redirect()->back()->withInput();
         }
         $brand->save();
     }
     return redirect('home/brands');
 }
Beispiel #12
0
 public function handleAction(Request $request)
 {
     $action = $request->input('_action');
     if ($action == 'addCategory') {
         $this->validate($request, ['name' => 'unique:categories']);
         Category::create($request->all());
         return response(['status' => 'success']);
     } else {
         if ($action == 'addBrand') {
             $this->validate($request, ['name' => 'unique:brands']);
             Brand::create($request->all());
             return response(['status' => 'success']);
         } else {
             return response(['status' => 'error']);
         }
     }
 }
Beispiel #13
0
 public function store()
 {
     $input = Input::all();
     $file = Input::file('image');
     $rules = array('image' => 'required|image', 'title' => 'required');
     $niceNames = array('image' => 'brand image', 'title' => 'Title');
     $validator = Validator::make($input, $rules);
     $validator->setAttributeNames($niceNames);
     if ($validator->fails()) {
         return Response::json(['success' => false, 'errors' => $validator->getMessageBag()->toArray()]);
     } else {
         $destinationPath = 'uploads/brands/';
         $filename = $file->getClientOriginalName();
         Input::file('image')->move($destinationPath, $filename);
         $create = Brand::create(['show' => 0, 'title' => Input::get('title')]);
         //when create a user, it will attach a member role
         $Brand = Brand::find($create->id);
         $ext = substr($filename, strrpos($filename, "."));
         $newFileName = basename($filename, $ext) . "_" . $Brand->id . "_" . date("Ymdhis") . $ext;
         rename($destinationPath . $filename, $destinationPath . $newFileName);
         Brand::where('id', $Brand->id)->update(['image_path' => $destinationPath . $newFileName]);
         return Response::json(['success' => true, 'message' => 'A Brand has been created!', 'file' => asset($destinationPath . $filename)]);
     }
 }
 public function run()
 {
     DB::table('brands')->delete();
     Brand::create(array('post_id' => 1, 'name' => 'Comedy Central'));
     Brand::create(array('post_id' => 1, 'name' => 'Netflix'));
 }
Beispiel #15
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // Copy distributable storage folder
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         shell_exec('xcopy /H /E /Y ' . public_path('storage.dist') . ' ' . public_path('storage'));
     } else {
         shell_exec('cp -R ' . public_path('storage.dist') . ' ' . public_path('storage'));
     }
     Model::unguard();
     // $this->call(UserTableSeeder::class);
     if (!DB::table('users')->count()) {
         User::create(['name' => 'Admin', 'email' => '*****@*****.**', 'password' => Hash::make('admin'), 'twitter_id' => '', 'facebook_id' => '', 'gplus_id' => '', 'avatar' => '']);
     }
     if (!DB::table('roles')->count()) {
         Role::create(['name' => 'Admin', 'content_permission' => 'NONE']);
         Role::create(['name' => 'Backoffice User', 'content_permission' => 'ROLE']);
         Role::create(['name' => 'Registered', 'content_permission' => 'NONE']);
     }
     if (!DB::table('role_user')->count()) {
         DB::table('role_user')->insert([['role_id' => 1, 'user_id' => 1]]);
     }
     if (!DB::table('permissions')->count()) {
         Permission::create(['label' => 'Backoffice', 'http' => 'GET', 'route' => 'admin']);
         Permission::create(['label' => 'Pages List', 'http' => 'GET', 'route' => 'admin/pages/list']);
         Permission::create(['label' => 'Users List', 'http' => 'GET', 'route' => 'admin/users/list']);
         Permission::create(['label' => 'Roles List', 'http' => 'GET', 'route' => 'admin/roles/list']);
         Permission::create(['label' => 'Permissions List', 'http' => 'GET', 'route' => 'admin/permissions/list']);
         Permission::create(['label' => 'Site Brand', 'http' => 'GET', 'route' => 'admin/brands/list']);
         Permission::create(['label' => 'Delete Content', 'http' => 'GET', 'route' => 'admin/contents/delete']);
         Permission::create(['label' => 'Change Content Ownership', 'http' => 'GET', 'route' => 'admin/contents/ownership']);
     }
     if (!DB::table('permission_role')->count()) {
         DB::table('permission_role')->insert([['role_id' => 3, 'permission_id' => 1, 'access' => 'DENY'], ['role_id' => 2, 'permission_id' => 2, 'access' => 'DENY'], ['role_id' => 2, 'permission_id' => 3, 'access' => 'DENY'], ['role_id' => 2, 'permission_id' => 4, 'access' => 'DENY'], ['role_id' => 2, 'permission_id' => 5, 'access' => 'DENY'], ['role_id' => 2, 'permission_id' => 6, 'access' => 'DENY'], ['role_id' => 2, 'permission_id' => 7, 'access' => 'DENY'], ['role_id' => 2, 'permission_id' => 8, 'access' => 'DENY']]);
     }
     if (!DB::table('brands')->count()) {
         Brand::create(['name' => 'Brand', 'slogan' => 'Brand slogan...', 'description' => 'Brand description', 'keywords' => 'keyword', 'author' => 'author', 'logo' => 'picture.png', 'active' => 1, 'css' => '', 'config' => '']);
     }
     if (!DB::table('contents')->count()) {
         Content::create(['user_id' => 1, 'lang' => 'en', 'title' => 'Demo', 'seo_slug' => 'demo', 'seo_title' => 'Demo', 'seo_description' => 'Demo', 'seo_keywords' => 'demo', 'seo_author' => 'admin', 'seo_image' => 'picture.png', 'content' => '<p>Content...<br></p>', 'publish_start' => '2015-07-01', 'role_permission' => 'NONE']);
     }
     if (!DB::table('events')->count()) {
         Event::create(['content_id' => 1, 'start' => '2015-07-1', 'end' => '2015-07-2']);
     }
     if (!DB::table('locations')->count()) {
         Location::create(['content_id' => 1, 'address' => 'Lisbon, Portugal', 'lat' => '38.7222524', 'lon' => '-9.139336599999979', 'zoom' => 5]);
     }
     if (!DB::table('pages')->count()) {
         Page::create(['name' => 'demo_notfound', 'route' => 'page/notfound', 'active' => 1]);
         Page::create(['name' => 'demo_home', 'route' => 'demo/home', 'active' => 1]);
         Page::create(['name' => 'demo_content', 'route' => '{slug}', 'active' => 1]);
         Page::create(['name' => 'demo_events', 'route' => 'demo/events', 'active' => 1]);
         Page::create(['name' => 'demo_map', 'route' => 'demo/map', 'active' => 1]);
         Page::create(['name' => 'demo_webgis', 'route' => '/', 'active' => 1]);
     }
     if (!DB::table('projections')->count()) {
         Projection::create(['srid' => '3857', 'proj4_params' => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext  +no_defs', 'extent' => '-20026376.39 -20048966.10 20026376.39 20048966.10']);
     }
     if (!DB::table('layers')->count()) {
         $content = new Content();
         $content->user_id = 1;
         $content->lang = 'en';
         $content->title = 'Open Street Map';
         $content->seo_slug = 'open-street-map';
         $content->role_permission = 'NONE';
         $content->save();
         Layer::create(['user_id' => 1, 'content_id' => $content->id, 'projection_id' => 3857, 'type' => 'osm']);
         $content = new Content();
         $content->user_id = 1;
         $content->lang = 'en';
         $content->title = 'Markers';
         $content->seo_slug = 'markers';
         $content->role_permission = 'NONE';
         $content->save();
         Layer::create(['user_id' => 1, 'content_id' => $content->id, 'projection_id' => 3857, 'type' => 'geojson', 'geojson_geomtype' => 'Point', 'geojson_attributes' => 'label', 'geojson_features' => '{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[-851576.57182518,4456806.642252369]},"properties":{"label":"Tavira"}}],"crs":{"type":"name","properties":{"name":"EPSG:3857"}}}', 'feature_info_template' => '<p>{{ item.label }}</p>', 'search' => 'label', 'ol_style_static_icon' => 'ol_style_static_icon.png', 'ol_style_static_fill_color' => '', 'ol_style_static_stroke_color' => '', 'ol_style_static_stroke_width' => '']);
         Layer::find(2)->saveGeoJSONFile();
     }
     if (!DB::table('maps')->count()) {
         $content = new Content();
         $content->user_id = 1;
         $content->lang = 'en';
         $content->title = 'Map1';
         $content->seo_slug = 'map1';
         $content->role_permission = 'NONE';
         $content->publish_start = '2015-07-01';
         $content->save();
         Map::create(['user_id' => 1, 'content_id' => $content->id, 'projection_id' => 3857, 'center' => '0 0', 'zoom' => 2]);
         // Add OSM layer
         $mapitem = new Layeritem();
         $mapitem->map_id = 1;
         $mapitem->layer_id = 1;
         $mapitem->parent_id = 0;
         $mapitem->visible = 1;
         $mapitem->baselayer = 1;
         $mapitem->displayorder = 1;
         $mapitem->save();
         // Add markers layer
         $mapitem = new Layeritem();
         $mapitem->map_id = 1;
         $mapitem->layer_id = 2;
         $mapitem->parent_id = 0;
         $mapitem->visible = 1;
         $mapitem->baselayer = 0;
         $mapitem->displayorder = 1;
         $mapitem->save();
     }
     Model::reguard();
 }
Beispiel #16
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(BrandRequest $request, Brand $brand)
 {
     $brand->create($request->all());
     flash('Brand has been added');
     return Redirect::back();
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(Request $request)
 {
     $this->brands->create($request->only('name'));
     return \Redirect::route('admin.brands.index')->withMessage(trans('brand.brands-controller-successfully_created'));
 }
 private function generateBrandSeed($name)
 {
     $brand = ['name' => $name];
     Brand::create($brand);
 }
 public function upload(Request $request)
 {
     Brand::create(['logo' => $this->UploadAndNameImage($request), 'visible' => false]);
 }
Beispiel #20
0
 public function postCreate()
 {
     // create new brand in DB
     Brand::create(Input::all());
     return Redirect::route('brands')->with('success', 'New Brand Added');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $data = ['name' => $request->get('name')];
     Brand::create($data);
     return redirect()->route('brand.index');
 }