/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $this->validation_rules($request); $status = $request->input(); Status::create($status); Session::flash('flash_message', 'Data status layanan berhasil ditambahkan!'); return redirect('admin/status'); }
public function run() { DB::table('statuses')->delete(); $collection = [['status' => 'Tier One'], ['status' => 'Tier Two'], ['status' => 'Tier Three'], ['status' => 'Tier Four'], ['status' => 'Pending'], ['status' => 'Completed'], ['status' => 'Closed'], ['status' => 'Suspended']]; foreach ($collection as $record) { Status::create($record); } }
public function postReply(Request $req, $statusId) { $this->validate($req, ["reply-{$statusId}" => "required|max:1000"], ['required' => 'The reply body is required.']); $status = Status::notReply()->find($statusId); if (!$status) { return redirect()->route('home'); } if (!Auth::user()->isFriendsWith($status->user) && Auth::user()->id !== $status->user->id) { return redirect()->route('home'); } $reply = Status::create(['body' => $req->input("reply-{$statusId}")])->user()->associate(Auth::user()); $status->replies()->save($reply); return redirect()->back(); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Status $status, StoreStatus $request) { $status->create($request->all()); return redirect('statuses')->with('alert-success', 'Статус успешно добавлен!'); }