當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Location::save方法代碼示例

本文整理匯總了PHP中app\Location::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP Location::save方法的具體用法?PHP Location::save怎麽用?PHP Location::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Location的用法示例。


在下文中一共展示了Location::save方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addLocation

 public function addLocation(Request $request)
 {
     $location = new Location();
     $location->picture_id = $this->id;
     $location->getLocation($this, $request);
     $location->save();
 }
開發者ID:faltastic,項目名稱:Syria-On-The-Move,代碼行數:7,代碼來源:Picture.php

示例2: store

 public function store(Request $request)
 {
     $input = $request->all();
     $location = new Location();
     $link = stripUnicode($input['name']);
     $location->name = $input['name'];
     $location->address = $input['address'];
     $location->link = stripUnicode($input['name']) . '_' . stripUnicode($input['address']);
     $location->contact = $input['contact'];
     $location->category_id = $input['category_id'];
     $location->area = $input['area'];
     $location->sale = $input['sale'];
     $location->describe = $input['describe'];
     $location->price = $input['price'];
     $user = new User();
     $user = $user->findEmail(session('user_email'));
     $location->user_id = $user->id;
     $location->save();
     foreach ($input['fileAnh'] as $anh) {
         if ($anh) {
             $image = new Image();
             $save_up = 'public/images/';
             $_avatar = $location->link;
             $_avatar = rand(0, 1000) . stripUnicode($_avatar) . '.jpg';
             $image->location_id = $location->id;
             $image->link = $save_up . $_avatar;
             $anh->move($save_up, $_avatar);
             $image->save();
         }
     }
     return Redirect::to('quanlydiadiem');
 }
開發者ID:hienmvvn,項目名稱:taptheduc,代碼行數:32,代碼來源:HomeController.php

示例3: store

 public function store(Request $request)
 {
     $tstamp = Carbon::now(-6);
     if (Auth::check()) {
         $staff_id = Auth::user()->id;
         $sfname = Auth::user()->fname;
         $slname = Auth::user()->lname;
     } else {
         return redirect('auth/login');
     }
     //name,locationtype,description,isactive,datedoc,datestart,datestop,eie,staff_id,sfname,slname
     $location = new Location();
     $location->name = $request->input('name');
     $location->locationtype = $request->input('locationtype');
     //per diem or per service
     $location->description = $request->input('description');
     $location->datestart = $request->input('datestart');
     $location->datestop = $request->input('datestop');
     $location->datedoc = $request->input('datedoc');
     $location->staff_id = $staff_id;
     $location->sfname = $sfname;
     //$request->input('sfname');
     $location->slname = $slname;
     //$request->input('slname');
     $location->isactive = 1;
     $location->eie = 0;
     $location->save();
     return redirect('locations')->with('status', 'Created Location');
 }
開發者ID:jdmays,項目名稱:ls1,代碼行數:29,代碼來源:LocationController.php

示例4: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $location = new Location();
     $location->name = Input::get('name');
     $location->save();
     return Response::json(array('success' => 'Location has been added!'));
 }
開發者ID:subhadip-sahoo,項目名稱:laravel,代碼行數:12,代碼來源:LocationController.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // Model::unguard();
     //create a user
     $user = new User();
     $user->email = "hotel@test.com";
     $user->password = Hash::make('password');
     $user->save();
     //create a country
     $country = new Country();
     $country->name = "United States";
     $country->id = 236;
     $country->save();
     //create a state
     $state = new State();
     $state->name = "Pennsylvania";
     $state->id = 1;
     $state->save();
     $city = new City();
     $city->name = "Pittsburgh";
     $city->id = 1;
     $city->save();
     //create a location
     $location = new Location();
     $location->city_id = $city->id;
     $location->state_id = $state->id;
     $location->country_id = $country->id;
     $location->latitude = 40.44;
     $location->longitude = 80;
     $location->code = '15212';
     $location->address_1 = "100 Main Street";
     $location->save();
     //create a new accommodation
     $accommodation = new Accommodation();
     $accommodation->name = "Royal Plaza Hotel";
     $accommodation->location_id = $location->id;
     // $location->id;
     $accommodation->description = "A modern, 4-star hotel";
     $accommodation->save();
     //create a room
     $room1 = new App\Room();
     $room1->id = 1;
     $room1->room_number = 'A01';
     $room1->accommodation_id = $accommodation->id;
     $room1->save();
     //create another room
     $room2 = new Room();
     $room2->id = 2;
     $room2->room_number = 'A02';
     $room2->accommodation_id = $accommodation->id;
     $room2->save();
     //create the room array
     $rooms = [$room1, $room2];
     //$this->call('AuthorsTableSeeder');
     //$this->command->info('Authors table seeded!');
     //
     $this->call(AmenityTableSeeder::class);
     $this->command->info('Amenity Class Seeded table seeded!');
 }
開發者ID:piyushpk89,項目名稱:MasteringLaravelCode_by_Christopher_John,代碼行數:64,代碼來源:DatabaseSeeder.php

示例6: storeLocation

 public static function storeLocation($request)
 {
     $location = new Location();
     $location->doctor_id = $request->get('doctor_id');
     $location->address = $request->get('address');
     $location->save();
     return redirect()->back()->with('message', 'Location was added.');
 }
開發者ID:morph07,項目名稱:lead-scheduler,代碼行數:8,代碼來源:Location.php

示例7: add

 function add(Request $request)
 {
     $this->validate($request, ['address_name' => 'required', 'postalCode_name' => 'required', 'city_name' => 'required', 'province_name' => 'required', 'country_name' => 'required']);
     $json_raw = Input::get('maps_json_name');
     $json_obj = json_decode($json_raw);
     $city = '';
     $country = '';
     $province = '';
     $street_num = '';
     $street_name = '';
     $postal_code = '';
     $lat = $json_obj[0]->geometry->location->lat;
     $lng = $json_obj[0]->geometry->location->lng;
     foreach ($json_obj[0]->address_components as $comp) {
         switch ($comp->types[0]) {
             case 'street_number':
                 //STREET NUMBER
                 $street_num = $comp->long_name;
                 break;
             case 'route':
                 //STREET NAME
                 $street_name = $comp->long_name;
                 break;
             case 'administrative_area_level_1':
                 //STATE/PROVINCE
                 $province = $comp->short_name;
                 break;
             case 'postal_code':
                 //POSTAL CODE
                 $postal_code = $comp->long_name;
                 break;
             case 'country':
                 //COUNTRY
                 $country = $comp->long_name;
                 break;
             case 'neighborhood':
             case 'locality':
                 $city = $comp->long_name;
                 break;
         }
     }
     if ($city == '' | $country == '' | $province == '' | $street_name == '' | $street_num == '' | $postal_code == '') {
         return redirect('addProperty')->withErrors(["We can't find your full address, please update your info and resubmit"]);
     }
     $property = new Location();
     $property->user()->associate(Auth::user());
     $property->street_address = $street_num . " " . $street_name;
     $property->postal_code = $postal_code;
     $property->province = $province;
     $property->country = $country;
     $property->longitude = $lng;
     $property->latitude = $lat;
     $property->city = $city;
     // $property->image_path = $filename;
     $property->save();
     return redirect('profileProperties');
 }
開發者ID:PrestonEn,項目名稱:BarbaricWaffle,代碼行數:57,代碼來源:propertyController.php

示例8: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['location' => 'required|max:100']);
     $location = new Location();
     $location->location = $request->location;
     $location->save();
     Session::flash('flash_message', 'Location successfully added!');
     return redirect()->route("location.index");
 }
開發者ID:renciebautista,項目名稱:em,代碼行數:15,代碼來源:LocationsController.php

示例9: saveLocation

 public function saveLocation(Request $request)
 {
     $location = new Location();
     $location->lattitude = $request->input('lattitude');
     $location->longitude = $request->input('longitude');
     $location->post_id = $request->input('post_id');
     $location->user_id = Auth::id();
     $location->save();
     return response()->json($location);
 }
開發者ID:sukruthmk,項目名稱:cast,代碼行數:10,代碼來源:LocationController.php

示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $location = new Location();
     if ($location->validate(Input::all(), Location::$rules)) {
         $location = new Location(Input::except('_token'));
         $location->save();
         Notification::success('Localidad "' . $location->name . '" añadida correctamente');
         return redirect('locations');
     } else {
         $errors = $location->errors();
         return redirect()->back()->withInput()->withErrors($errors);
     }
 }
開發者ID:archer3cl,項目名稱:adhl,代碼行數:19,代碼來源:LocationController.php

示例11: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $location = new Location();
     if (Request::has('location') && Request::input('location') != "") {
         $location->location = Request::input('location');
         $location->save();
         return Response::make("Success", 201);
     } else {
         // Bad request, missing parameters
         return Response::make("Please provide a time and location.", 400);
     }
 }
開發者ID:BrynnLawson,項目名稱:smarka,代碼行數:18,代碼來源:LocationsController.php

示例12: add

 /**
  * Create a new loaction to connect a product to the current user
  */
 public function add()
 {
     $input = Request::all();
     $userid = Auth::User()->id;
     $location = new Location();
     $location->user_id = $userid;
     $location->product_id = $input['product_id'];
     $location->address = $input['address'];
     $location->zip = $input['zip'];
     $location->city = $input['city'];
     $location->country_code = $input['country_code'];
     $location->save();
     return redirect('/products');
 }
開發者ID:MetropoliaUAS,項目名稱:ISDProject-Online,代碼行數:17,代碼來源:ProductsController.php

示例13: createLocation

 /**
  * Create new employee location
  *
  * @param Request $request
  * @return mixed
  */
 public function createLocation(Request $request)
 {
     $rules = ['name' => 'required|alpha_spaces'];
     $v = Validator::make($request->all(), $rules);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v);
     } else {
         $location = new Location();
         $name = $request->input('name');
         $location->name = $name;
         $location->save();
         return redirect()->route('manageLocations')->with('flash_message', 'Location created');
     }
 }
開發者ID:heidilux,項目名稱:Laravel-Company-Directory,代碼行數:20,代碼來源:LocationController.php

示例14: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $input = $request->all();
     $location = new Location();
     $location->name = $input['name'];
     $location->address = $input['address'];
     $location->contact = $input['contact'];
     $location->category_id = $input['category_id'];
     $location->area = $input['area'];
     $location->sale = $input['sale'];
     $location->describe = $input['describe'];
     $location->price = $input['price'];
     $location->save();
     return Redirect::to('admin');
 }
開發者ID:hiennv94,項目名稱:taptheduc,代碼行數:21,代碼來源:AdminController.php

示例15: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     // create the new Location
     $location = new Location();
     $location->number = $request->number;
     $location->address = $request->address;
     $location->type = $request->type;
     $location->bedrooms = $request->bedrooms;
     $location->bathrooms = $request->bathrooms;
     $location->sqft = $request->sqft;
     $location->built = $request->built;
     $location->mlsid = $request->mlsid;
     $location->details = $request->details;
     $location->save();
     return redirect()->action('LocationController@show', $location->id);
 }
開發者ID:elconejito,項目名稱:RabbitHome,代碼行數:22,代碼來源:LocationController.php


注:本文中的app\Location::save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。