| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -3,15 +3,41 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					namespace App\AdminAgent\Controllers; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use App\AdminAgent\Repositories\Channel; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use App\Models\Channel as ChannelModel; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use Dcat\Admin\Admin; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use Dcat\Admin\Form; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use Dcat\Admin\Grid; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use Dcat\Admin\Layout\Content; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use Dcat\Admin\Layout\Row; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use Dcat\Admin\Show; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use Dcat\Admin\Http\Controllers\AdminController; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use Dcat\Admin\Tree; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use Illuminate\Support\Facades\Storage; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					class ChannelController extends AdminController | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						public function index(Content $content) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return $content->header('产品频道') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								->body(function (Row $row) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									$tree = new Tree(new ChannelModel()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									$tree->query(function ($model) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										//agent_id为0是系统分类,其它是代理商分类
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										return $model->where('agent_id', Admin::user()->id)->orderBy('sort')->orderBy('id'); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									}); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									/*$prefix = Storage::disk('public')->url(''); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									$tree->branch(function ($branch) use ($prefix) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										$src = $prefix . $branch['icon'] ; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										$logo = '<img data-action="preview-img" src="'.$src.'" style="max-width:30px;max-height:30px;cursor:pointer;margin-left:20px;" class="img">'; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										return "{$branch['id']} - {$branch['name']} $logo"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									});*/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									$row->column(12, $tree); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								}); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						/** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * Make a grid builder. | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return Grid | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |