当前位置: 首页>>代码示例>>PHP>>正文


PHP User::user方法代码示例

本文整理汇总了PHP中App\Model\User::user方法的典型用法代码示例。如果您正苦于以下问题:PHP User::user方法的具体用法?PHP User::user怎么用?PHP User::user使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App\Model\User的用法示例。


在下文中一共展示了User::user方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createDemand

    public static function createDemand(){
    	$validator = self::validator();
        if ($validator->fails()) {
            return back()->withErrors($validator->errors())->withInput();
        }

    	DB::transaction(function() use(&$warehouse){
    		$demand = Demand::create([
    			'type_id'	=>	1,
    			'title' 	=>	request('title'),
    			'user_id'   => User::user()->id,
    			'desc'      => request('desc'),
                'stage'     => 2,
    		]);

    		$warehouse = new self(request()->all());
    		$warehouse = $demand->warehouse()->save($warehouse);
    	});

    	if ($warehouse != null) {
    		return redirect('user/demand');
    	}else {
    		return back()->withErrors('创建失败')->withInput();
    	}
    }
开发者ID:xinray,项目名称:html-css,代码行数:25,代码来源:Warehouse.php

示例2: supply

	public function supply($id){
		$supply = Supply::find($id);

		if($supply == null){
			return API::error([1002, '没有该供应信息']);
		}

		$use = User::user();
		if ($supply->user_id == $user->id) {
            return API::error([1003, '不能给自己创建的供应发送留言']);
        }

        $message = Message::create([
        	'user_id'   => $user->id,
            'type'      => 'supply',
            'supply_id' => $supply->id,
            'demand_id' => null,
            'title'     => request('title'),
        ]);

        if ($message == null) {
            return API::error([1004, '发送意向失败']);
        }

        return API::success();
	}
开发者ID:xinray,项目名称:html-css,代码行数:26,代码来源:MessageController.php

示例3: createSupply

    public static function createSupply()
    {
        $validator = self::validator();
        if ($validator->fails()) {
            return back()->withErrors($validator->errors())->withInput();
        }

        DB::transaction(function() use (&$personal) {
            $supply = Supply::create([
                'type_id'   => 3,
                'title'     => request('title'),
                'user_id'   => User::user()->id,
                'desc'      => request('desc'),
                'stage'     => 2,
            ]);

            $personal = new self(request()->all());

            $personal = $supply->personal()->save($personal);
        });

        if ($personal != null) {
            return redirect('user/supply');
        } else {
            return back()->withErrors('创建失败')->withInput();
        }
    }
开发者ID:xinray,项目名称:html-css,代码行数:27,代码来源:Personal.php

示例4: demand

    public function demand($id)
    {
        $demand = Demand::find($id);
        if ($demand == null) {
            return API::error([1002, '没有该需求信息']);
        }

        $user = User::user();
        if ($demand->user_id == $user->id) {
            return API::error([1003, '不能给自己创建的需求发送意见']);
        }

        $coop = Cooperation::create([
            'user_send' => $user->id,
            'user_recv' => $demand->user_id,
            'type'      => 'demand',
            'demand_id' => $demand->id,
            'supply_id' => null,
            'phone'     => request('phone'),
            'contacts'  => request('contacts'),
            'content'   => request('content'),
        ]);

        if ($coop == null) {
            return API::error([1004, '发送意向失败']);
        }

        return API::success();
    }
开发者ID:xinray,项目名称:html-css,代码行数:29,代码来源:CooperationController.php

示例5: getEdit

    public function getEdit($id)
    {
        $supply = Supply::get($id);

        if ($supply->supply->user_id != User::user()->id) {
            return view('errors.common')->withErrors('只能编辑自己发布的信息');
        }

        return view('supply.supply_edit')
            ->withSupply($supply)
            ->withType(strtolower($supply->type->code));
    }
开发者ID:xinray,项目名称:html-css,代码行数:12,代码来源:SupplyController.php

示例6: editSupply

    public static function editSupply($id)
    {
        $supply = self::get($id);

        if ($supply == null) {
            return back()->withInput();
        }

        if ($supply->supply->user_id != User::user()->id) {
            return view('errors.common')->withErrors('只能编辑自己发布的信息');
        }

        $type = $supply->type->code;

        switch ($type) {
            case 'warehouse':
                return Supply\Warehouse::editSupply($supply);
                break;
            case 'vehicle':
            return Supply\Vehicle::editSupply($supply);
                break;
            case 'personal':
                return Supply\Personal::editSupply($supply);
                break;
            case 'building':
                break;
            case 'general':
                break;
            default:
                return back()->withInput();
        }
    }
开发者ID:xinray,项目名称:html-css,代码行数:32,代码来源:Supply.php

示例7: demand

 public function demand()
 {
     $demands = Demand::where('user_id', User::user()->id)->orderBy('created_at', 'desc')->paginate();
     return view('user.demand')->withDemands($demands);
 }
开发者ID:xinray,项目名称:html-css,代码行数:5,代码来源:UserController.php


注:本文中的App\Model\User::user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。