コード例 #1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $countries = Country::all();
     return view('flyers.edit', compact('countries'));
 }
コード例 #2
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $options = array_combine(array_values(Country::all()), array_keys(Country::all()));
     return view('flyer.create', compact('options'));
 }
コード例 #3
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $countries = Country::all();
     return view('flyers.create', compact('countries'));
 }
コード例 #4
0
 public function compose(View $view)
 {
     $view->with(['countries' => Country::all()]);
 }
コード例 #5
0
 /**
  * Turn this item object into a generic array
  *
  * @return array
  */
 public function transform(Initiative $initiative)
 {
     return ['id' => (int) $initiative->id, 'name' => $initiative->name, 'country' => ['name' => implode('', array_keys(Country::get(strtolower($initiative->country)))), 'code' => strtolower($initiative->country)], 'active' => (bool) $initiative->active, 'dates' => ['started_at' => (int) $initiative->started_at->format('U'), 'ended_at' => $initiative->ended_at ? (int) $initiative->ended_at->format('U') : null, 'created_at' => (int) $initiative->created_at->format('U'), 'updated_at' => (int) $initiative->updated_at->format('U')], 'links' => [['rel' => 'self', 'uri' => url('/initiatives/' . $initiative->id)]]];
 }