示例#1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param AdduserRequest $request
  * @return \Illuminate\Http\Response
  */
 public function store(AdduserRequest $request)
 {
     //        $input = $request->all();                               // get all data
     //        $input['confirmed'] = 1;                                // set confirmed to 1
     //        $input['password'] = Hash::make($input['password']);    // hash password
     //
     //        $user       =   User::create($input);                   // save above details
     $user = User::create(['first_name' => $request->first_name, 'last_name' => $request->last_name, 'email' => $request->email, 'confirmed' => 1, 'password' => Hash::make($request->password)]);
     //        $profile    =   $user->profile()->save(new Profile);    // also create new profile
     //        $profile->apartment_id  =   Auth::user()->profile->defaultApartment; // get current defaultApartment
     //        $profile->save();                                       // save details on profile
     $profile = Profile::create(['user_id' => $user->id, 'apartment_id' => Auth::user()->profile->defaultApartment]);
     dd(Auth::user()->profile->defaultApartment);
     $role = Role::whereName('user')->first();
     $user->assignRole($role);
     //Assign Role
     $block_no = $request->blockno;
     // get block_no from profileform
     $floor_no = $request->floorno;
     // get floor_no from profileform
     $profile->apartments()->attach($profile->defaultApartment, ['approved' => '1', 'block_no' => $block_no, 'floor_no' => $floor_no]);
     // attach this profile with default apartment, with approved = 1, and block_no, floor_no according to profileform in apartment_profile pivot table.
     Crm_account::create(['account' => $user->first_name . $user->last_name, 'fname' => $user->first_name, 'lname' => $user->last_name, 'company' => 'Company Name', 'email' => $user->email, 'address' => 'Current Address', 'city' => 'Nagpur', 'state' => 'Maharashtra', 'zip' => '440012', 'country' => 'India']);
     return redirect()->back()->withMessage('User has been Added')->withStatus('success');
 }
示例#2
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $date_created = Carbon::now();
     $date_expiry = Carbon::now()->addMonth(1);
     $crm = ['' => 'Select Contact'] + Crm_account::lists('account', 'id')->toArray();
     $stage = ['Draft' => 'Draft', 'Delivered' => 'Delivered', 'Accepted' => 'Accepted', 'Lost' => 'Lost', 'Dead' => 'Dead'];
     $tax = ['' => 'None'] + SysTax::lists('name', 'id')->toArray();
     $tags = Sys_tag::lists('text', 'id');
     $disable = null;
     return view('invoice.create', compact('disable', 'crm', 'stage', 'tax', 'tags', 'date_created', 'date_expiry'));
 }
示例#3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     try {
         $list = Transaction::find($id);
         $account = ['' => 'Choose an Account'] + Bankncash::DefaultApartment()->lists('account', 'id')->toArray();
         $payeeid = ['0' => 'Select Payee'] + Crm_account::lists('account', 'id')->toArray();
         $payment = ['0' => 'Select Payment Method'] + PMethod::lists('name', 'id')->toArray();
         $category = Sys_cat::where('type', '=', 'Income')->lists('name', 'id')->toArray();
         $tag = Sys_tag::where('type', '=', 'Income')->lists('text', 'id');
         $disable = 1;
     } catch (Exception $e) {
         return redirect()->back()->withMessage('Error Editing Expense, Possibly it is already Deleted')->withStatus('error');
     }
     return view('expense.edit', compact('list', 'account', 'payeeid', 'payment', 'category', 'tag', 'disable'));
 }
示例#4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $crm = Crm_account::findOrFail($id);
     $crm->delete();
     return redirect()->route('crm.index', compact('crm'))->withMessage('Contact has been Deleted')->withStatus('success');
 }