Exemplo n.º 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $types = [['name' => 'Multimedia (Installations) & Performances', 'slug' => 'multimedia-performances'], ['name' => 'Music', 'slug' => 'music'], ['name' => 'Photography', 'slug' => 'photography'], ['name' => 'Video', 'slug' => 'video'], ['name' => 'Acting', 'slug' => 'acting']];
     foreach ($types as $_type) {
         $type = \App\WorkType::create($_type);
     }
 }
Exemplo n.º 2
0
 /**
  * Edit a particular Work.
  * @param $id
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function edit($id)
 {
     $work = \App\Work::where(['id' => $id])->first();
     $workVideos = $work->videos;
     $workTypes = \App\WorkType::all();
     return view('admin.works.edit', ['work' => $work, 'workVideos' => $workVideos, 'workTypes' => $workTypes]);
 }
Exemplo n.º 3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('work_types')->truncate();
     WorkType::create(['id' => 1, 'name' => 'Full Day']);
     WorkType::create(['id' => 2, 'name' => 'Half Day']);
     WorkType::create(['id' => 3, 'name' => 'Work From Home']);
 }
Exemplo n.º 4
0
 /**
  * reads Project table by unique index
  *  - if not found, emit a not found message.
  *  - if found return the $project record to the caller.
  *
  * @param [in] $text
  * @return record.
  */
 public static function checkIfExists($text)
 {
     $workType = WorkType::where('type', '=', $text)->first();
     if (!is_null($workType)) {
         appGlobals::existsMessage(appGlobals::getWorkTypeTableName(), $workType->type, $workType->id);
     }
     return $workType;
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $edition = array('First edition', 'Second edition', 'Third edition', 'Fourth edition', 'Fifth edition', 'Sixth edition', 'Seventh edition', 'Eighth edition', 'Ninth edition', 'Tenth edition');
     $status = array('active', 'inactive');
     $publishers = \App\Publisher::getByStatus(\App\Publisher::STATUS_ACTIVE)->get()->toArray();
     $workTypes = \App\WorkType::all()->toArray();
     for ($i = 0; $i < 50; $i++) {
         $work = new \App\Work();
         $work->title = 'work name ' . $i;
         $work->publication_year = rand(2000, 2015);
         $work->edition = $edition[array_rand($edition)];
         $work->price = 123.45;
         $work->isbn = '12345678910' . $i;
         $work->publisher_id = $publishers[array_rand($publishers)]['id'];
         $work->work_type_id = $workTypes[array_rand($workTypes)]['id'];
         $work->status = $status[array_rand($status)];
         $work->save();
     }
 }
Exemplo n.º 6
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $out['artist'] = Artist::findOrNew((int) $id);
     if (Request::ajax()) {
         $out['work_type'] = WorkType::orderBy('id')->get(['id', 'name']);
         return $out;
     }
     $releases = $out['artist']->credit_name;
     $out['credits'] = [];
     foreach ($releases as $row) {
         //		  $out['credits'][$row->work->name]	= $row->credit;
         if (isset($row->credit->track->id)) {
             $out['credits'][$row->work->name]['tracks'][] = $row->credit->track;
         } elseif (isset($row->credit->release->id)) {
             $out['credits'][$row->work->name]['releases'][] = $row->credit->release;
         }
     }
     return view('artists.show', $out);
 }
Exemplo n.º 7
0
 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     // register the ProjectObserver class.
     Client::observe(new ClientObserver());
     // register the ProjectObserver class.
     Project::observe(new ProjectObserver());
     // register the WorkTypeObserver class.
     WorkType::observe(new WorkTypeObserver());
     // register the TimeCardFormatObserver class.
     TimeCardFormat::observe(new TimeCardFormatObserver());
     // register the WorkObserver class.
     Work::observe(new WorkObserver());
     // register the TimeCardObserver class.
     TimeCard::observe(new TimeCardObserver());
     // register the TimeCardHoursWorkedObserver class.
     TimeCardHoursWorked::observe(new TimeCardHoursWorkedObserver());
     // register the TaskTypeObserver class.
     TaskType::observe(new TaskTypeObserver());
     // register the TaskObserver class.
     Task::observe(new TaskObserver());
 }
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(App\User::class, function (Faker\Generator $faker) {
    return ['name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt('default')];
});
$factory->define(App\Author::class, function (Faker\Generator $faker) {
    $status = array('active', 'inactive');
    return ['name' => $faker->name, 'status' => $status[array_rand($status)]];
});
$factory->define(App\WorkType::class, function (Faker\Generator $faker) {
    return ['description' => $faker->word];
});
$factory->define(App\Publisher::class, function (Faker\Generator $faker) {
    $status = array('active', 'inactive');
    return ['name' => $faker->name, 'status' => $status[array_rand($status)]];
});
$factory->define(App\Work::class, function (Faker\Generator $faker) {
    $edition = array('First edition', 'Second edition', 'Third edition', 'Fourth edition', 'Fifth edition', 'Sixth edition', 'Seventh edition', 'Eighth edition', 'Ninth edition', 'Tenth edition');
    $status = array('active', 'inactive');
    $publishers = \App\Publisher::getByStatus(\App\Publisher::STATUS_ACTIVE)->get()->toArray();
    $workTypes = \App\WorkType::all()->toArray();
    return ['title' => $faker->name, 'publication_year' => rand(2000, 2015), 'edition' => $edition[array_rand($edition)], 'price' => 102.15, 'isbn' => $faker->isbn13, 'publisher_id' => $publishers[array_rand($publishers)]['id'], 'work_type_id' => $workTypes[array_rand($workTypes)]['id'], 'status' => $status[array_rand($status)]];
});
Exemplo n.º 9
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     if (Gate::denies('admin')) {
         abort(403);
     }
     $out = ['form_route' => ['route' => ['track.update', $id], 'method' => 'PUT', 'class' => 'form-horizontal'], 'artist_credit' => []];
     $out['track'] = Track::findOrNew((int) $id);
     $out['genre'] = Genre::orderBy('id')->lists('name', 'id');
     if (count(Request::old())) {
         $old = Request::old();
         $out['release'] = Release::find($old['release_id']);
         if (isset($old['artist_credit']['id'])) {
             foreach ($old['artist_credit']['id'] as $n => $ac_id) {
                 $artist = Artist::where('id', $ac_id)->firstOrFail();
                 if (count($artist)) {
                     $out['artist_credit'][$n]['name'] = $artist->name;
                     $out['artist_credit'][$n]['work_type_id'] = $old['artist_credit']['work'][$n];
                     $out['artist_credit'][$n]['join_phrase'] = $old['artist_credit']['join'][$n];
                     $out['artist_credit'][$n]['artist_id'] = $old['artist_credit']['id'][$n];
                 }
             }
         }
     } else {
         $out['release'] = $out['track']->release;
         $out['artist_credit'] = $out['track']->credit->credit_name;
     }
     $out['work_type'] = WorkType::all();
     $out['genres_selected'] = [];
     foreach ($out['track']->genres as $row) {
         $out['genres_selected'][] = $row->id;
     }
     return view('tracks.form', $out);
 }
Exemplo n.º 10
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $pages = \App\Page::all();
     $workTypes = \App\WorkType::all();
     return view('admin.index', ['pages' => $pages, 'workTypes' => $workTypes]);
 }
Exemplo n.º 11
0
     // get $project->id
     $project = Project::where('name', '=', 'Magento Development')->first();
     // get $project->id
     $workType = WorkType::where('type', '=', 'Atlassian Ticket')->first();
     $work = new Work();
     $work->work_type_description = $description;
     $work->project_id = $project->id;
     $work->work_type_id = $workType->id;
     $work->save();
 }
 $description = 'A new landing page is required to support Fall 2016 GNO.';
 if (is_null($work = Work::checkIfExists($description))) {
     // get $project->id
     $project = Project::where('name', '=', 'Magento Development')->first();
     // get $project->id
     $workType = WorkType::where('type', '=', 'Feature')->first();
     $work = new Work();
     $work->work_type_description = $description;
     $work->project_id = $project->id;
     $work->work_type_id = $workType->id;
     $work->save();
 }
 /*******************************************************************************************************************
  * time_card insert(s)
  ******************************************************************************************************************/
 // get $work->id
 $work = Work::where('work_type_description', '=', 'The catalog view is performing too slowly.')->first();
 // get $timeCardFormat->id
 $timeCardFormat = TimeCardFormat::where('description', '=', 'Day of week starts on SAT and ends on SUN')->first();
 $timeCard = new TimeCard();
 $timeCard->work_id = $work->id;
Exemplo n.º 12
0
 /**
  * Returns view for work listing with all required info. If does not exist return 404.
  * @param $slug
  */
 public function showWorksPage($slug)
 {
     $workType = \App\WorkType::where(['slug' => $slug])->firstOrFail();
 }