예제 #1
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function createShop()
 {
     $rules = array('shop_name' => 'required', 'shop_address' => 'required', 'shop_code' => 'required');
     // Create a new validator instance from our validation rules
     $validator = Validator::make(Input::all(), $rules);
     // If validation fails, we'll exit the operation now.
     if ($validator->fails()) {
         // Ooops.. something went wrong
         //  echo "validation issues...";
         return Redirect::back()->withInput()->withErrors($validator);
     }
     $data = new Shop();
     $data->shop_name = Input::get('shop_name');
     $data->shop_address = Input::get('shop_address');
     $data->shop_code = Input::get('shop_code');
     $data->is_active = Input::has('is_active') ? 1 : 0;
     //$data->shop_code = Input::get('is_active');
     //return $data;exit;
     //$data->image_name = $safeName;
     //echo '<pre>';
     //print_r($data);
     //echo '</pre>';
     if ($data->save()) {
         //echo 'i am in save';
         return redirect()->route("shops")->with('message', 'Success');
         //return redirect()->action('HomeController@index');
     } else {
         return Redirect::back()->with('error', Lang::get('banners/message.error.create'));
     }
 }
예제 #2
0
 public function store(Request $request)
 {
     $dates = explode(',', $request->input('shopdate'));
     foreach ($dates as $date) {
         $shop = new Shop();
         $shop->user_id = $request->user_id;
         $shop->shopdate = $date;
         $shop->save();
     }
     Flash::success('সঠিক ভাবে সম্পন্ন হয়েছে।');
     return redirect()->back();
 }
예제 #3
0
 /**
  * Insert or Update table from txt file.
  *
  * @param  array  $split_row
  * @return Response
  */
 public function processRow($split_row)
 {
     $mall_name = $split_row[0];
     $floor = $split_row[1];
     $lot_no = $split_row[2];
     $shop = Shop::where('name', $mall_name)->first();
     if (isset($shop)) {
         $shop->name = $mall_name;
         $shop->floor = $floor;
         $shop->lot_no = $lot_no;
         $shop->save();
     } else {
         $shop = new Shop();
         $shop->name = $mall_name;
         $shop->floor = $floor;
         $shop->lot_no = $lot_no;
         $shop->save();
     }
 }
예제 #4
0
 public function store(Request $request)
 {
     $asset = new Shop($request->all());
     $asset->save();
     return redirect('shops');
 }