Exemplo n.º 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $tip = new Tip();
     $tip->body = 'Looking for exam resources? Besides our review ' . 'session (which are fantabulous), we also have a test cabinet in ' . 'the lab (GOL-1670)!';
     $tip->member_id = 1;
     $tip->save();
 }
Exemplo n.º 2
0
 public static function getRandTip()
 {
     $tips = Cache::remember(self::CACHE_KEY, self::CACHE_MINUTES, function () {
         return Tip::all();
     });
     return $tips->random();
 }
Exemplo n.º 3
0
 public function updateTip(Request $request, $id)
 {
     $Tip = Tip::find($id);
     $Tip->title = $request->input('title');
     $Tip->author = $request->input('author');
     $Tip->isbn = $request->input('isbn');
     $Tip->save();
     return response()->json($Tip);
 }
Exemplo n.º 4
0
 public function destroy($id)
 {
     $tip = Tip::find($id);
     Tip::destroy($id);
     return redirect('tip/index');
 }
Exemplo n.º 5
0
 /**
  * Remove the specified tip from storage.
  *
  * Marks the tip as removed from the application (uses soft deletes).
  *
  * @Delete("/{id}")
  * @Response(204)
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Tip::destroy($id);
     return response('', Response::HTTP_NO_CONTENT);
 }
Exemplo n.º 6
0
 public function tips()
 {
     $now = Carbon::now();
     $tips = Tip::where('start', '<', $now)->where('end', '>', $now)->get();
     return response()->json(['tips' => $tips]);
 }
Exemplo n.º 7
0
 protected function setupLayout()
 {
     View::share('siteStat', app('App\\good\\Stat\\Stat')->getSiteStat());
     View::share('siteTip', Tip::getRandTip());
 }