Ejemplo n.º 1
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     if (!isset($data['type'])) {
         $data['type'] = 'none';
     } elseif ($data['type'] == 'member') {
         Validator::make($data, ['firstname' => 'required', 'lastname' => 'required']);
         //create user
         $user = User::create(['name' => $data['firstname'] . ' ' . $data['lastname'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'contact' => $data['contact'], 'type' => $data['type']]);
         $member = new Member();
         $member->user_id = $user->id;
         $member->firstname = $data['firstname'];
         $member->lastname = $data['lastname'];
         if ($member->save()) {
             session()->flash('success', 'Member Profile Created Successfully!');
         } else {
             $user->delete();
             session()->flash('error', 'Error! Please try again..');
         }
     } elseif ($data['type'] == 'artist') {
         Validator::make($data, ['firstname' => 'required', 'lastname' => 'required']);
         //create user
         $user = User::create(['name' => $data['firstname'] . ' ' . $data['lastname'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'contact' => $data['contact'], 'type' => $data['type']]);
         $artist = new Artist();
         $artist->user_id = $user->id;
         $artist->firstname = $data['firstname'];
         $artist->lastname = $data['lastname'];
         if ($artist->save()) {
             session()->flash('success', 'Artist Profile Created Successfully!');
         } else {
             $user->delete();
             session()->flash('error', 'Error! Please try again..');
         }
     } elseif ($data['type'] == 'studio') {
         Validator::make($data, ['name' => 'required', 'title' => 'required']);
         //create user
         $user = User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'contact' => $data['contact'], 'type' => $data['type']]);
         $studio = new Studio();
         $studio->user_id = $user->id;
         $studio->name = $user->name;
         $studio->title = $data['title'];
         if ($studio->save()) {
             session()->flash('success', 'Studio Created Successfully!');
         } else {
             $user->delete();
             session()->flash('error', 'Error! Please try again..');
         }
     }
     //dd($data);
     //do your role stuffs here
     //send verification mail to user
     //--------------------------------------------------------------------------------------------------------------
     //$data['verification_code']  = $user->verification_code;
     Mail::send('emails.welcome', $data, function ($message) use($data) {
         $message->from('*****@*****.**', "Tattoo Cultr");
         $message->subject("Welcome to Tattoo Cultr");
         $message->to($data['email']);
     });
     return $user;
 }
Ejemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $muse = new Artist(['name' => 'Muse', 'origin' => 'Teignmouth, Devon, England', 'activeFrom' => Carbon::create(1994), 'activeTo' => null, 'source' => 'wikipedia']);
     $muse->save();
     $muse->labels()->attach([Label::where(['name' => 'Warner Bros.'])->first()->id, Label::where(['name' => 'Helium 3'])->first()->id, Label::where(['name' => 'Taste'])->first()->id, Label::where(['name' => 'Mushroom'])->first()->id, Label::where(['name' => 'East West'])->first()->id, Label::where(['name' => 'Dangerous'])->first()->id]);
     $radiohead = new Artist(['name' => 'Radiohead', 'origin' => 'Abingdon, Oxfordshire, England', 'activeFrom' => Carbon::create(1985), 'activeTo' => null, 'source' => 'wikipedia']);
     $radiohead->save();
     $radiohead->labels()->attach([Label::where(['name' => 'XL'])->first()->id, Label::where(['name' => 'Ticker Tape Ltd.'])->first()->id, Label::where(['name' => 'Hostess'])->first()->id, Label::where(['name' => 'TBD'])->first()->id, Label::where(['name' => 'Parlophone'])->first()->id, Label::where(['name' => 'Capitol'])->first()->id]);
     $a7x = new Artist(['name' => 'Avenged Sevenfold', 'origin' => 'Huntington Beach, California, U.S.', 'activeFrom' => Carbon::create(1999), 'activeTo' => null, 'source' => 'wikipedia']);
     $a7x->save();
     $a7x->labels()->attach([Label::where(['name' => 'Warner Bros.'])->first()->id, Label::where(['name' => 'Hopeless'])->first()->id, Label::where(['name' => 'Good Life'])->first()->id]);
 }
Ejemplo n.º 3
0
 public function getDataArtist(DestroyArtistRequest $request)
 {
     $id = Input::get('id');
     $result = [];
     $model = new Artist();
     $data = $model->where('id', $id)->first()->toArray();
     foreach ($data as $k => $aData) {
         $result[$k] = $aData;
     }
     $nameFileAvatar = $result['avatar'];
     $result['avatar'] = $nameFileAvatar;
     return json_encode($result);
 }
Ejemplo n.º 4
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //$member = Member::find($id);
     $profileUser = User::where('slug', $id)->first();
     $member = Member::where('user_id', $profileUser->id)->first();
     $user = Auth::user();
     $isMemberProfile = false;
     $isFollowing = false;
     $showWelcomeMessage = false;
     if (Auth::check()) {
         if ($member->user_id == Auth::User()->id) {
             $isMemberProfile = true;
             if (!$user->welcomed) {
                 $showWelcomeMessage = true;
                 $user->welcomed = true;
                 $user->save();
             }
         }
         if (Follower::where('user_id', $member->user->id)->where('follower_id', $user->id)->count()) {
             $isFollowing = true;
         }
     }
     $artists = Artist::where('verified', true)->orderBy('firstname', 'asc')->get();
     $categories = Tag::where('isCategory', true)->get();
     return view('pages.member', ['member' => $member, 'isMemberProfile' => $isMemberProfile, 'isFollowing' => $isFollowing, 'artists' => $artists, 'categories' => $categories, 'showWelcomeMessage' => $showWelcomeMessage]);
 }
Ejemplo n.º 5
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $artist = \App\Artist::find($id);
     $name = \Input::get('name');
     $artist->name = $name;
     $artist->save();
     return redirect('artists');
 }
Ejemplo n.º 6
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit(Studio $studio, Event $event)
 {
     $artists = Artist::all()->lists('name', 'id');
     $pieces = Piece::lists('title', 'id')->all();
     $event->date = $event->starts->format('Y-m-d');
     $event->startTimeField = $event->starts->format('H:i');
     $event->endTimeField = $event->ends->format('H:i');
     return view('admin.studio.events.edit', compact('studio', 'event', 'artists', 'pieces'));
 }
Ejemplo n.º 7
0
 public function index()
 {
     View::share(['sideBar' => NavigatorHelper::getSideBarBE()]);
     $status = Status_orders::all(['name', 'id'])->toArray();
     $newProduct = Cd::whereIn('public_date', [Carbon::today(), Carbon::today()->subDay(3)])->count();
     $newArtist = Artist::whereIn('created_at', [Carbon::today(), Carbon::today()->subDay(3)])->count();
     $newOrder = Order::where('status', Order::PENDING)->count();
     $newCustomer = Customer::whereIn('created_at', [Carbon::today(), Carbon::today()->subDay(3)])->count();
     return view('backend.index')->with(['status' => $status, 'newProduct' => $newProduct, 'newArtist' => $newArtist, 'newOrder' => $newOrder, 'newCustomer' => $newCustomer]);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function update($id)
 {
     if (Auth::check()) {
         $artist = \App\Artist::find($id);
         $name = \Input::get('name');
         $artist->name = $name;
         $artist->save();
         return redirect('artists');
     } else {
         return redirect(url());
     }
 }
 public function create()
 {
     $artists = ['default' => 'Choose an artist'] + Artist::orderby('name', 'ASC')->lists('name', 'id')->all();
     $eras = ['default' => 'Choose an era'] + Era::lists('name', 'id')->all();
     $categories = ['default' => 'Choose a category'] + Category::orderby('name', 'ASC')->lists('name', 'id')->all();
     $colors = ['default' => 'Choose a color'] + Color::orderby('colorEnglish', 'ASC')->lists('colorEnglish', 'id')->all();
     $styles = ['default' => 'Choose a style'] + Style::orderby('name', 'ASC')->lists('name', 'id')->all();
     $newestAuction = Auction::where('FK_status_id', '=', 1)->orWhere('FK_status_id', '=', 3)->orderBy('created_at', 'desc')->first();
     $timenow = Carbon::now()->addDays(1)->toDateString();
     //de datum nu
     return View::make('create')->with('artists', $artists)->with('eras', $eras)->with('categories', $categories)->with('colors', $colors)->with('styles', $styles)->with('newestAuction', $newestAuction)->with('timenow', $timenow);
 }
Ejemplo n.º 10
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit(Request $request, $id)
 {
     $concerts = Concert::orderBy('created_at', 'asc')->get();
     $currentConcert = Concert::where('id', $id)->first();
     $artists = Artist::orderBy('created_at', 'asc')->get();
     $lieux = array();
     foreach ($concerts as $concert) {
         if (!in_array($concert->lieu, $lieux)) {
             $lieux[] = $concert->lieu;
         }
     }
     return view('admin_edit', ['lieux' => $lieux, 'artists' => $artists, 'currentConcert' => $currentConcert]);
 }
Ejemplo n.º 11
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required|unique:auctions|max:255', 'artist' => 'required|max:255', 'year' => 'required|integer|digits_between:3,4|max:2016', 'width' => 'required|numeric', 'height' => 'required|numeric', 'depth' => 'numeric', 'description' => 'required|max:255', 'condition' => 'required|max:255', 'origin' => 'required|max:255', 'picture' => 'required', 'minprice' => 'required|numeric|', 'buyout' => 'required|numeric|greater_than_field:minprice', 'date' => 'required|date|after:today', 'terms' => 'required|accepted']);
     $artist = Artist::where('name', $request->artist)->first();
     if (!$artist) {
         $artist = new Artist(['name' => $request->artist]);
     }
     $artist->save();
     $auction = new Auction(['title' => $request->title, 'description' => $request->description, 'start' => Carbon::now(), 'end' => $request->date, 'buy_now' => $request->buyout, 'price' => $request->minprice, 'status' => 'Active', 'style_id' => Style::Where('name', $request->style)->first()->id]);
     $artwork = new Artwork(['name' => $request->title, 'width' => $request->width, 'height' => $request->height, 'depth' => $request->depth, 'condition' => $request->condition, 'origin' => $request->origin, 'year' => $request->year]);
     $auction->save();
     $artwork->auction()->associate($auction);
     $artwork->save();
     // Picture save
     $imageName = $artwork->id . '.' . $request->file('picture')->getClientOriginalExtension();
     $artwork->image = $imageName;
     $request->file('picture')->move(base_path() . '/public/img/', $imageName);
     $artist->artworks()->save($artwork);
     $owner = $request->user();
     $owner->auctionsowner()->save($auction);
     return redirect('/auctions/' . $owner->id);
 }
Ejemplo n.º 12
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     view()->composer('*', function ($view) {
         $filterData = filter_optie::orderBy('naam')->get();
         $artists = Artist::orderBy('name')->get();
         $newarray = array();
         foreach ($filterData as $filter) {
             $newarray[$filter->filter_id][$filter->naam] = $filter->naam;
         }
         view()->share(['newarray' => $newarray, 'artists' => $artists]);
     });
     return $next($request);
 }
Ejemplo n.º 13
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\AddArtistRequest $request)
 {
     $artist = new Artist(array('name' => $request->get('name'), 'biography' => $request->get('biography')));
     $artist->save();
     //bagong artist
     flash()->overlay('Artist added!', 'Success!');
     if ($request->get('track_id')) {
         $artistHasSong = new ArtistHasSong(array('artist_id' => $artist->id, 'track_id' => (int) $request->get('track_id')));
         $artistHasSong->save();
         // go to albums params track-id,artist id,album name,artist name create album for//
         // return redirect('/album/create')
         //         ->with(['artist_id' => $artist->id, 'artist_name' => $artist->name,
         //                 'track_id' => $request->get('track_id'),
         //                 'album_name' => $request->get('album_name')]);
         return view('album.create', ['artist_id' => $artist->id, 'artist_name' => $artist->name, 'track_id' => $request->get('track_id'), 'album_name' => $request->get('album_name')]);
     } else {
         // go to albums params artist id,album name,artist name create album for//
         // return redirect('/album/create')
         //         ->with(['artist_id' => $artist->id, 'artist_name' => $artist->name,
         //              'track_id' => NULL, 'album_name' => $request->get('album_name')]);
         //bagong artist, walang album
         return view('album.create', ['artist_id' => $artist->id, 'artist_name' => $artist->name, 'track_id' => NULL, 'album_name' => $request->get('album_name')]);
     }
     /*if ($request->get('artist_id')===NULL && 
                  $request->get('artist_name')===NULL && 
                  $request->get('track_id')===NULL ) {
     
                 return view('artist.create',
                             ['message'=>"Artist Created"]);
             }
             */
     //getting an album
     /*
     $album = DB::table('albums')
             ->where('name',$request->get('album_name'))
             ->first();          
     */
 }
Ejemplo n.º 14
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     if (Gate::denies('admin')) {
         abort(403);
     }
     $out = ['form_route' => ['route' => 'artistalias.store', 'method' => 'POST', 'class' => 'form-horizontal']];
     if (count(Request::old())) {
         $old = Request::old();
         $out['alias'] = (object) $old;
         if (!isset($out['alias']->is_ended)) {
             $out['alias']->is_ended = 0;
         }
         $out['alias']->artist_id = $old['artist_id'];
         $out['alias']->artist_name = Artist::findOrNew($old['artist_id'])->name;
     } elseif ((int) Request::get('artist_id') > 0) {
         $out['alias'] = Artist::findOrNew(Request::get('artist_id'));
         $out['alias']->artist_id = (int) Request::get('artist_id');
         $out['alias']->artist_name = $out['alias']->name;
     } else {
         $out['alias'] = new Artist();
     }
     $out['alias_types'] = ArtistAliasType::lists('name', 'id');
     return view('alias.form', $out);
 }
Ejemplo n.º 15
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $userPriveleges = DB::table('user_privelege')->where('user_id', '=', $id)->delete();
     $user = User::findOrFail($id);
     if ($artist = Artist::where('user_id', '=', $id)->first()) {
         $artist->user_id = 0;
         $artist->save();
     }
     $user->delete();
     return redirect()->action('UserController@index');
 }
Ejemplo n.º 16
0
 /**
  * Remove the specified artist from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if (Auth::check() && Auth::user()->hasOnePrivelege(['Administrator'])) {
         $artist = Artist::findOrFail($id);
         if (Input::get('delete') == "delete") {
             $artist->delete();
         } elseif (Input::get('delete') == "deleteAll") {
             $artworks = Artwork::where('artist', $id)->delete();
             $artist->delete();
         } else {
         }
         return redirect('/artists');
     } else {
         return View::make('errors/' . HttpCode::Unauthorized);
     }
 }
Ejemplo n.º 17
0
 /**
  * Remove the specified tattoo from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function deleteTattoo(Request $request)
 {
     if (!$request->ajax()) {
         dd("NO ASYNC REQUEST");
     }
     $res = array();
     $res['success'] = false;
     $tattooId = $request->input('tattoo');
     $tattoo = Tattoo::find($tattooId);
     $user = Auth::user();
     if ($tattoo) {
         if ($tattoo->user_id == $user->id) {
             $tattoo->delete();
             $res['success'] = true;
         } elseif ($user->type == 'artist') {
             $artist = Artist::where('user_id', $user->id)->first();
             $artist->tattoos()->detach($tattooId);
             $res['success'] = true;
         } elseif ($user->type == 'studio') {
             $studio = Studio::where('user_id', $user->id)->first();
             $studio->tattoos()->detach($tattooId);
             $res['success'] = true;
         }
     }
     return $res;
 }
Ejemplo n.º 18
0
 /**
  * Send Follow Request
  *
  * @return View
  */
 public function UnfollowArtist($id)
 {
     $user = Auth::user();
     $artist = Artist::find($id);
     if ($artist) {
         $follow = Follow::where('artist_id', $id)->where('user_id', $user->id)->first();
         $follow->delete();
         return redirect('artist/' . $artist->id)->with('success', 'You Unfollowed ' . $artist->user->firstname);
     }
     return redirect('artist/' . $artist->id);
 }
Ejemplo n.º 19
0
 public function update(Request $request, $id)
 {
     $art = Artist::find($id);
     $art->fill($request->input())->save();
     return redirect('artist');
 }
Ejemplo n.º 20
0
 /**
  * Change Account Basic details
  *
  * @param  Request  $request
  * @return Response
  */
 public function changeProfile(Request $request)
 {
     $this->validate($request, ['current_password' => 'required|min:6']);
     $user = Auth::user();
     if ($user->type == 'studio') {
         $this->validate($request, ['name' => 'required']);
     } else {
         $this->validate($request, ['firstname' => 'required']);
     }
     if ($user->email != $request->input('email')) {
         $this->validate($request, ['email' => 'required|email|max:255|unique:users']);
     }
     if ($user->contact != $request->input('contact')) {
         $this->validate($request, ['contact' => 'required|digits:10']);
     }
     if (Hash::check($request->input('current_password'), $user->password)) {
         if ($user->type == 'artist') {
             $artist = Artist::where('user_id', $user->id)->first();
             $artist->firstname = $request->input('firstname');
             $artist->lastname = '';
             $artist->save();
             $user->name = $request->input('firstname');
         } elseif ($user->type == 'member') {
             $member = Member::where('user_id', $user->id)->first();
             $member->firstname = $request->input('firstname');
             $member->lastname = '';
             $member->save();
             $user->name = $request->input('firstname');
         } elseif ($user->type == 'studio') {
             $studio = Studio::where('user_id', $user->id)->first();
             $studio->title = '';
             $studio->name = $request->input('name');
             $studio->save();
             $user->name = $request->input('name');
         }
         $user->email = $request->input('email');
         $user->contact = $request->input('contact');
         $user->save();
         return redirect('profile#edit')->with('success', 'Profile changed successfully!');
     }
     return redirect('profile#edit')->with('warning', 'Wrong Password!');
 }
Ejemplo n.º 21
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $track = Track::find($id);
     $artists = Artist::all();
     return view('tracks.edit', compact('track', 'artists'));
 }
 /**
  * Display the artist's followers
  *
  * @return View
  */
 public function edit()
 {
     $user = Auth::user();
     if (!$user->social) {
         $user->avatar = url('uploads/images/small/' . $user->avatar);
     }
     //if user is artist, load artist profile view
     if ($user->type == 'artist') {
         $artist = Artist::where('user_id', $user->id)->first();
         $studios = Studio::all();
         $artist->cover = url('uploads/images/small/' . $artist->cover);
         return view('pages.profile.artist.edit', ['user' => $user, 'artist' => $artist, 'studios' => $studios]);
     }
     //member can't have followers. so redirect to profile
     return view('pages.profile.member.edit', ['user' => $user]);
 }
Ejemplo n.º 23
0
 public function artist()
 {
     return Artist::where('name', '=', $this->artist_name);
 }
Ejemplo n.º 24
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $artists = \App\Artist::lists('name', 'id');
     $song = \App\Song::find($id);
     return view('canciones.edit', compact('song', 'artists'));
 }
Ejemplo n.º 25
0
 /**
  * Approve Tattoo
  *
  * @return View
  */
 public function rejectTattoo($id)
 {
     $user = Auth::user();
     $artist = Artist::where('user_id', $user->id)->first();
     $tattoo = Tattoo::find($id);
     if ($tattoo) {
         if ($tattoo->artist_id == $artist->id) {
             $tattoo->delete();
             return redirect('artist/' . $artist->id)->with('success', 'Tattoo Deleted Successfully');
         }
     }
     return redirect('artist/' . $artist->id);
 }
Ejemplo n.º 26
0
 public function searchComposer(Request $request)
 {
     //get data
     $dataRequest = $request->all();
     $key = $dataRequest['key'];
     if (!is_null($key) && !empty($key)) {
         $key = Input::get('key');
         $model = new Artist();
         return json_encode($model->searchComposer($key));
     } else {
         return json_encode([]);
     }
 }
Ejemplo n.º 27
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(TrackRequest $request, $id)
 {
     if (Gate::denies('admin')) {
         abort(403);
     }
     $track = Track::find($id);
     // Old track data
     $req = $request->all();
     // Request data
     $genre = [];
     // genre list
     $genre_old = [];
     // genre list
     foreach ($req['genre'] as $n => $genre_id) {
         $genre[$n] = GenreTrack::where('track_id', $id)->where('genre_id', $genre_id)->first();
         if ($genre[$n] == null) {
             $genre_new = ['genre_id' => $genre_id, 'track_id' => $id];
             $genre[$n] = new GenreTrack($genre_new);
             $genre[$n]->save();
         }
         $genre_old[] = $genre[$n]->id;
     }
     GenreTrack::where('track_id', $id)->whereNotIn('id', $genre_old)->delete();
     $ac = [];
     // list of ArtistCreditNames
     $ac_old = [];
     // List of artist credit names that already exist
     $artists = [];
     // List of artists, just for counting
     foreach ($req['artist_credit']['work'] as $n => $work_id) {
         $artist_id = $req['artist_credit']['id'][$n];
         $join_phrase = $req['artist_credit']['join'][$n];
         $artists[$artist_id] = $join_phrase . ' ' . Artist::find($artist_id)->name;
         // artiat counter
         // Checking if ArtistCreditName already exists
         $ac[$artist_id . '_' . $work_id . '_' . $join_phrase] = ArtistCreditName::where('work_type_id', (int) $work_id)->where('artist_id', $artist_id)->where('join_phrase', $join_phrase)->where('artist_credit_id', $track->credit->id)->first();
         if ($ac[$artist_id . '_' . $work_id . '_' . $join_phrase] == null) {
             // Creating new ArtistCreditName
             $ac_new = ['artist_credit_id' => $track->credit->id, 'artist_id' => $artist_id, 'work_type_id' => $work_id, 'position' => '', 'name' => Artist::find($artist_id)->name, 'join_phrase' => $join_phrase];
             $ac[$artist_id . '_' . $work_id . '_' . $join_phrase] = new ArtistCreditName($ac_new);
         }
         // Sets position. Not important for now there is no ordering in form
         // TODO make ordering in form
         $ac[$artist_id . '_' . $work_id . '_' . $join_phrase]->position = $n;
         // Saving ArtistCreditNames
         $ac[$artist_id . '_' . $work_id . '_' . $join_phrase]->save();
         // preventing deleting of used ArtistCreditNAmes
         $ac_old[] = $ac[$artist_id . '_' . $work_id . '_' . $join_phrase]->id;
     }
     // Delete not used ArtistCreditNames
     ArtistCreditName::where('artist_credit_id', $track->credit->id)->whereNotIn('id', $ac_old)->delete();
     $track->credit->artist_count = count($artists);
     $track->credit->ref_count = count($ac);
     $track->credit->name = trim(implode(' ', $artists), ' &');
     $track->credit->save();
     // Saving track data
     $track->update($req);
     // Redirect back to Show with message
     return redirect()->route('track.show', ['track' => $id])->with('alert-success', [trans('htmusic.saved')]);
 }
Ejemplo n.º 28
0
 public function show($id)
 {
     $artist = Artist::find($id);
     $artist->load('labels');
     return $artist;
 }
Ejemplo n.º 29
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     if (Gate::denies('admin')) {
         abort(403);
     }
     // TODO "Add Image" button
     $out = ['form_route' => ['route' => ['image.update', $id], 'method' => 'PUT', 'class' => 'form-horizontal', 'files' => true]];
     if (count(Request::old())) {
         $rq = Request::old();
         $out['image'] = new Image($rq);
         if (isset($rq['artist_id']) && is_array($rq['artist_id'])) {
             $out['image']->artists = Artist::whereIn('id', $rq['artist_id'])->get();
         }
         if (isset($rq['release_id']) && is_array($rq['release_id'])) {
             $out['image']->releases = Release::whereIn('id', $rq['release_id'])->get();
         }
         if (isset($rq['track_id']) && is_array($rq['track_id'])) {
             $out['image']->tracks = Track::whereIn('id', $rq['track_id'])->get();
         }
     } else {
         $out['image'] = Image::findOrNew($id);
     }
     return view('images.form', $out);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     if (Auth::check()) {
         $artists = \App\Artist::lists('name', 'id');
         $song = \App\Song::find($id);
         return view('canciones.edit', compact('song', 'artists'));
     } else {
         return redirect(url());
     }
 }