/** * 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(); }
public static function getRandTip() { $tips = Cache::remember(self::CACHE_KEY, self::CACHE_MINUTES, function () { return Tip::all(); }); return $tips->random(); }
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); }
public function destroy($id) { $tip = Tip::find($id); Tip::destroy($id); return redirect('tip/index'); }
/** * 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); }
public function tips() { $now = Carbon::now(); $tips = Tip::where('start', '<', $now)->where('end', '>', $now)->get(); return response()->json(['tips' => $tips]); }
protected function setupLayout() { View::share('siteStat', app('App\\good\\Stat\\Stat')->getSiteStat()); View::share('siteTip', Tip::getRandTip()); }