Exemplo n.º 1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     if (Auth::check()) {
         $user = Auth::user();
         $customer = Customer::find($user->id);
         if ($customer == null) {
             $customer = new Customer();
             $customer->id_user = $user->id;
             $customer->save();
         }
         $customer = array_merge($customer->toArray(), $user->toArray());
         return view('customer.show', array('head' => array('title' => "منو کاربری" . $customer['name']), 'customer' => $customer));
     }
     return redirect('/user/login');
 }