/** * Удаление статуса * * @param Status $status * @return \Illuminate\Http\RedirectResponse * @throws \Exception */ public function delete(Status $status) { if (Organization::where('status_id', $status->id)->exists()) { dd('Есть организации с таким статусом'); } $status->delete(); return redirect()->route('admin::status'); }
public function index(Status $status) { if (Auth::check()) { $userIds = Auth::user()->followedUsers()->lists('followed_id'); $userIds[] = Auth::user()->id; // WhereIn to find where a column's value equals the value in an array // Eager loading comments $statuses = $status->with('comments')->whereIn('user_id', $userIds)->latest()->get(); } else { $statuses = $status->all(); } return view('statuses.index')->with('statuses', $statuses); }
/** * Run the database seeds. * * @return void */ public function run() { $statuses = ["S" => "Saved", "P" => "Pending Approval", "A" => "Approved", "D" => "Declined"]; foreach ($statuses as $key => $description) { try { $status = new Status(); $status['id'] = $key; $status['description'] = $description; $status->save(); } catch (Exception $e) { print $description . " already exists.\n"; } } }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Name $name) { // Edit an exisiting name $brands = Brand::lists('short_name', 'id'); $statuses = Status::lists('name', 'id'); return view('names.edit', compact('name', 'brands', 'statuses')); }
/** * Run the database seeds. * * @return void */ public function run() { Status::create(['status' => 'Only Me', 'description' => 'Unpublished only creator can see it']); Status::create(['status' => 'Restricted', 'description' => 'Restricted by community']); Status::create(['status' => 'Public', 'description' => 'Everyone can see']); Status::create(['status' => 'Unsaved', 'description' => 'Work not saved']); }
public function store(StatusSubmitRequest $request) { $status = \App\Status::create($request->all()); auth()->user()->statuses()->save($status); flash()->success('Posted Successfully'); return redirect()->back(); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('locations')->truncate(); Location::create(['name' => 'Phase 1, Level 1']); Location::create(['name' => 'Phase 1, Level 2']); Location::create(['name' => 'Phase 1, Level 3']); Location::create(['name' => 'Phase 2, Level 1']); Location::create(['name' => 'Phase 2, Level 2']); Location::create(['name' => 'Phase 2, Level 3']); Location::create(['name' => 'Phase 3, Level 1']); Location::create(['name' => 'Phase 3, Level 2']); Location::create(['name' => 'Phase 3, Level 3']); DB::table('areas')->truncate(); Area::create(['name' => 'AME']); Area::create(['name' => 'M&W']); Area::create(['name' => 'Ramp']); Area::create(['name' => 'SCI']); Area::create(['name' => 'Tool Install']); DB::table('categories')->truncate(); Category::create(['name' => 'Spec Gas']); Category::create(['name' => 'Electrical']); Category::create(['name' => 'Base Build']); Category::create(['name' => 'Design Request']); Category::create(['name' => 'Layout Optimization']); Category::create(['name' => 'Safety']); DB::table('status')->truncate(); Status::create(['name' => 'New', 'slug' => 'new']); Status::create(['name' => 'Open/Needs Further Review', 'slug' => 'open-needs-further-review']); Status::create(['name' => 'Waiting for Approval', 'slug' => 'waiting-for-approval']); Status::create(['name' => 'Rejected', 'slug' => 'rejected']); Status::create(['name' => 'Approved', 'slug' => 'approved']); }
public function run() { DB::table('statuses')->delete(); Status::create(['name' => 'Active']); Status::create(['name' => 'Inactive']); Status::create(['name' => 'Expired']); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $statuses = Status::all(); $products = Product::all(); $productionschedule = Batch::find($id); return view('production.edit', ['productionschedule' => $productionschedule, 'products' => $products, 'statuses' => $statuses]); }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $status = false; if ($this->method() == 'PATCH') { $routeAction = $this->route()->getAction(); $routeParameters = $this->route()->parameters(); $cid = false; if (isset($routeParameters['statusId'])) { $cid = $routeParameters['statusId']; } else { if (isset($routeParameters['one'])) { $cid = $routeParameters['one']; } } $status = \App\Status::find($cid); if (!$status) { dd('error'); } } switch ($this->method()) { case 'GET': case 'DELETE': return []; case 'PUT': return ['name' => 'required|unique:statuses,name']; case 'PATCH': return ['name' => 'required|unique:statuses,name,' . $status->id]; default: return []; break; } }
public function getProfileUser(Request $request, $id) { if ($request->user()) { $statuses = Status::where('user_id', $id)->orderBy('created_at', 'desc')->whereNull('parent_id')->simplePaginate(10); $user = User::where('id', $id)->first(); if ($statuses && $user) { $title = $user->getNameOrUsername(); return view('users.index')->withUser($user)->withStatuses($statuses)->withAuthUserIsFriend($request->user()->isFriendsWith($user))->withTitle($title); } else { return redirect()->route('home')->withError('Ошибка, свяжитесь с администратором.'); } } else { $data['user'] = User::where('id', $id)->first(); if ($data['user']) { $data['comments_count'] = $data['user']->comment->count(); $data['posts_count'] = $data['user']->posts->count(); $data['posts_active_count'] = $data['user']->posts->where('active', '1')->count(); $data['posts_draft_count'] = $data['user']->posts->where('active', '0')->count(); $data['latest_posts'] = $data['user']->posts->where('active', '1')->take(5); $data['latest_comments'] = $data['user']->comment->take(5); $data['user_id'] = $data['user']->id; $data['title'] = $data['user']->getNameOrUsername(); return view('users.stats', $data); } else { return redirect()->route('home')->withErrors('Ошибка, свяжитесь с администратором.'); } } }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Faker::create(); # Kosongin isi tabel DB::table('anggota')->delete(); DB::table('status')->delete(); DB::table('tokoBuku')->delete(); # Tambahkan data toko buku $tokoBuku = TokoBuku::create(array('nama' => 'Taman Bacaan', 'alamat' => 'Jl. Cikapundung no. 17', 'telp' => '022-3261723')); $this->command->info('Data Toko Buku telah diisi!'); #Faker $fake1 = Anggota::create(array('nama' => $faker->name, 'id_tokoBuku' => $tokoBuku->id)); $fake2 = Anggota::create(array('nama' => $faker->name, 'id_tokoBuku' => $tokoBuku->id)); $aulia = Anggota::create(array('nama' => 'Aulia Marchita', 'email' => '*****@*****.**', 'id_tokoBuku' => $tokoBuku->id)); $arvin = Anggota::create(array('nama' => 'Arvin Chs', 'email' => '*****@*****.**', 'id_tokoBuku' => $tokoBuku->id)); $puji = Anggota::create(array('nama' => 'Puji Muharani', 'email' => '*****@*****.**', 'id_tokoBuku' => $tokoBuku->id)); $this->command->info('Anggota telah diisi!'); Status::create(array('pekerjaan' => 'Pelajar', 'id_anggota' => $aulia->id)); Status::create(array('pekerjaan' => 'Mahasiswa', 'id_anggota' => $arvin->id)); Status::create(array('pekerjaan' => 'Pegawai', 'id_anggota' => $puji->id)); $this->command->info('Data anggota dan status telah diisi!'); DB::table('buku')->delete(); DB::table('anggota_buku')->delete(); # Isi tabel buku $circa = Buku::create(array('judul' => 'Circa', 'penulis' => 'Sitta Karina')); $madah = Buku::create(array('judul' => 'Madah', 'penulis' => 'Risa Saraswati')); $nts = Buku::create(array('judul' => 'Nothing To Lose', 'penulis' => 'Alia Zalea')); $aulia->buku()->attach($circa->id); $arvin->buku()->attach($nts->id); $arvin->buku()->attach($madah->id); $puji->buku()->attach($circa->id); $this->command->info('Anggota beserta buku telah diisi!'); }
/** * Run the database seeds. * * @return void */ public function run() { $statuses = config('webegg.statuses'); foreach ($statuses as $k => $v) { \App\Status::create(['name' => $k, 'style' => $v]); } }
public function update($id, StatusRequest $request) { // find specific Status $status = Status::findOrFail($id); $status->update($request->all()); return redirect('manage/status'); }
/** * Run the database seeds. * * @return void */ public function run() { Status::create(['description_es' => 'Ordenado', 'description_en' => 'Ordered']); Status::create(['description_es' => 'Cocinando', 'description_en' => 'Cooking']); Status::create(['description_es' => 'Cancelado', 'description_en' => 'Cancelled']); Status::create(['description_es' => 'Entregado', 'description_en' => 'Delivered']); }
public function save(Request $request, $id) { $status = new Status(); $status->problem_id = $id; $status->user_id = '0'; $status->time = '0'; $status->memory = '0'; $leng = $request->input('leng'); $status->language = $leng; //$status->source_code= $status->save(); $status = Status::orderby('solution_id', 'desc')->first(); $compile = new Compileinfo(); $compile->solution_id = $status->solution_id; $compile->save(); $code = new Source_code(); $code->solution_id = $status->solution_id; $code->source = $request->input('editor'); $code->save(); $code = Source_code::orderby('sourcecode_id', 'desc')->first(); $run = new Run(); $run->solution_id = $status->solution_id; $run->problem_id = $id; $run->language = $leng; $run->sourcecode_id = $code->sourcecode_id; $run->save(); return redirect('status/status'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $feedback = Feedback::find($id); $visibilities = Visibility::actual()->get()->lists('name', 'id'); $statuses = Status::actual()->get()->lists('name', 'id'); return view('backend.feedbacks.edit', ["feedback" => $feedback, "visibilities" => $visibilities, "statuses" => $statuses]); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Brand $brand) { // Edit an exisiting brand $statuses = Status::lists('name', 'id'); $types = Type::whereIn('tablename', ['all', 'brands'])->lists('name', 'id'); $users = User::lists('name', 'id'); return view('brands.edit', compact('brand', 'statuses', 'users', 'types')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $tarea = \App\Tarea::find($id); $proyectos = Proyecto::all(); $users = DB::table('users')->where('id_type', '=', '3')->get(); $status = Status::all(); return view('tarea.edit', compact('tarea', 'proyectos', 'users', 'status')); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $this->validate($request, ["title" => "required", "content" => "required|min:10", 'g-recaptcha-response' => 'required|captcha']); $data = $request->all(); $data['visibility_id'] = Visibility::actual()->where('name', 'private')->first()->id; $data['status_id'] = Status::actual()->where('name', 'open')->first()->id; $feedback = Feedback::create($data); return redirect(route('feedbacks.index')); }
public function edit($project_id, $ticket_id) { $ticket = \App\Ticket::find($ticket_id); if ($ticket->project->user_id == \Auth::user()->id) { return view('projects.tickets.edit', ['ticket' => $ticket, 'project' => $ticket->project, 'statuses' => \App\Status::all()]); } else { return \Redirect::route('projects.index')->with('danger', 'Permission denied.'); } }
/** * Find and return a Status only if current user is Owner. * * @param $id * @return mixed * @throws \Exception */ public function findOnlyIfOwner($id) { $status = Status::findOrFail($id); if (Auth::user() == $status->user) { return $status; } else { throw new \Exception("Not an Owner"); } }
public function run() { $faker = Faker::create(); // Array that contains various id's of user table $users = User::lists('id'); foreach (range(1, 1000) as $index) { Status::create(['user_id' => $faker->randomElement($users), 'body' => $faker->sentence(), 'created_at' => $faker->dateTimeThisMonth($max = 'Now')]); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Activity $activity) { // Edit an exisiting activity $statuses = Status::lists('name', 'id'); $leads = Lead::lists('firstname', 'id'); $types = Type::lists('name', 'id'); $users = User::lists('name', 'id'); return view('activities.edit', compact('activity', 'statuses', 'types', 'users', 'leads')); }
public function verifySlot($slot) { $status = \App\Status::find(1); foreach ($slot->status as $stat) { $slot->status()->detach(); } $status->slots()->attach($this); $this->updated_at = \Carbon\Carbon::now(); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Director $director) { // Edit an exisiting director $brands = Brand::lists('short_name', 'id'); $statuses = Status::lists('name', 'id'); $genders = Gender::lists('name', 'id'); $titles = Title::lists('name', 'id'); return view('directors.edit', compact('director', 'brands', 'statuses', 'users', 'titles', 'genders')); }
public function setStatus($id, $status) { //dd($status); if (Auth::User()->hasRole('administrator') || Auth::User()->hasRole('approver')) { $update = Status::select('id', 'name')->where('slug', $status)->first(); \App\Request::where('id', $id)->update(['status_id' => $update->id]); return response()->json(['status' => 'success', 'message' => $update->name]); } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { if (auth()->check()) { $statuses = Status::notReply()->where(function ($query) { return $query->where('user_id', auth()->user()->id)->orWhereIn('user_id', auth()->user()->friends()->lists('id')); })->orderBy('created_at', 'desc')->paginate(10); return view('timeline.index', compact('statuses')); } return view('home'); }
/** * Run the database seeds. * * @return void */ public function run() { factory(Feedback::class, 5)->create()->each(function ($item) { $visibility = Visibility::actual()->orderByRaw("RAND()")->first(); $status = Status::actual()->orderByRaw("RAND()")->first(); $item->visibility()->associate($visibility); $item->status()->associate($status); $item->save(); }); }
/** * Execute the command. * * @return void */ public function handle() { $status = Status::create($this->data); $this->user->statuses()->save($status); if ($this->project) { $this->project->statuses()->save($status); } event(new FeedableEvent('StatusPosted', $this->user, $status)); return $status; }