예제 #1
0
 private function getDropboxOfPartners()
 {
     $partners = Partner::all();
     $map = [];
     foreach ($partners as $partner) {
         $map[$partner->id] = $partner->company_name;
     }
     return $map;
 }
예제 #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, PartnerCreateRequest $request)
 {
     $partner = Partner::find($id);
     $partner->name = $request->get('name');
     $partner->link = $request->get('link');
     $partner->logo = $request->get('image');
     $partner->status = $request->get('status');
     $partner->save();
     return redirect()->route('admin.partner.index');
 }
예제 #3
0
 public function all_partner()
 {
     $number = get_setting('partner_widget_number');
     $order = get_setting('partner_widget_order');
     $orderby = get_setting('partner_widget_orderby');
     if ($orderby === 'random') {
         $partner = Partner::where('status', 1)->orderByRaw("RAND()")->take($number)->get();
     } else {
         $partner = Partner::where('status', 1)->take($number)->get();
     }
     return $partner;
 }
예제 #4
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     \App\Model\Partner::create(['company_name' => str_random(10), 'email' => str_random(10) . '@gmail.com', 'address' => str_random(10) . ',TP.HCM', 'description' => str_random(200) . '@gmail.com', 'phone_number' => str_random(12)]);
 }
예제 #5
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     Partner::create($request->all());
     return redirect('/admin/partners');
 }