示例#1
0
	/**
	 * Display a listing of the resource.
	 *
	 * @return Response
	 */
	public function index(Request $request)
	{
    $goods = Good::orderBy('id', 'desc')->get();

    $gid = empty($request->input('gid')) ? $goods[0]->id : $request->input('gid');

    $goodInfos = array();

    foreach ($goods as $key => $good) {

      $goodInfo = GoodAttribsInfo::where('gid', '=', $good->id)

        ->where('acode', '=', 'price')
      
        ->first();

      $goodInfos[$key] = $goodInfo;

    }

    $data = array (
    
      'goods' => $goods,

      'gid' => $gid,

      'active' => 'active',

      'goodInfos' => $goodInfos,

      'is_select' => true,

      'wTitle' => '购买临牌'
    
    );

    return view('goods/detail', $data);
    
	}
示例#2
0
	/**
	 * Show the application dashboard to the user.
	 *
	 * @return Response
	 */
	public function index(Request $request)
	{
    $goodDatas = Good::orderBy('id', 'desc')->get();

    $goods = array();

    $banners = Advertise::where('type', '=', 'index_banner')
      
      ->where('active', '=', 1)
      
      ->orderBy('seq', 'asc')
      
      ->get();

    foreach ($goodDatas as $good) {

      $gInfo = GoodAttribsInfo::where('gid', '=', $good->id)

        ->where('acode', '=', 'price')

        ->first();

      $good->price = $gInfo->value;

      array_push($goods, $good);

    }

    $homeGoodsDisplay = array();

    foreach ($goods as $key => $good) {

      if (0 == $key % 2) {

        $homeGoodsDisplay[$key / 2] = array();

      }

      $homeGoodsDisplay[$key / 2][] = $good;

    }

    /////
    $goods = Good::orderBy('id', 'desc')->get();

    $gid = empty($request->input('gid')) ? $goods[0]->id : $request->input('gid');

    $goodInfos = array();

    foreach ($goods as $key => $good) {

      $goodInfo = GoodAttribsInfo::where('gid', '=', $good->id)

        ->where('acode', '=', 'price')
      
        ->first();

      $goodInfos[$key] = $goodInfo;

    }
    /////

    return view('home', array(
    
      'goods' => $goods,

      'banners' => $banners,

      'home' => 1,

      'gid' => $gid,

      'active' => 'active',

      'goodInfos' => $goodInfos,

      'is_select' => true,

      'wTitle' => '51临牌网-您身边的车辆临时牌照专家'
    
    ));

	}
 public function search(Request $request)
 {
     $keyword = $request->keyword . "%";
     $goods = Good::orderBy('created_at', 'desc')->where('name', 'like', $keyword)->paginate(config('wfhshop.page_size'));
     return view('admin.good.index', ['goods' => $goods]);
 }