protected function makeImage($file, $height, $width, $randomFilename, $thumbnail = null) { $md5 = md5_file($file->getRealPath()); $img = Image::make($file)->fit($height, $width); $path = 'images/'; if ($thumbnail != null) { $path = 'images/thumb/'; } $image = Images::where('md5_hash', $md5)->first(); if ($image === null or $image->thumbnail_file == null) { Clockwork::info('Storing on Filesystem'); $img->save(storage_path() . '/app/' . $path . $randomFilename . '.png', 90); } if ($image === null and $thumbnail === null) { Clockwork::info('New Image'); $image = new Images(); $image->user_id = Auth::user()->id; $image->filename = $file->getClientOriginalName(); $image->file = $randomFilename . '.png'; $image->height = $height; $image->width = $width; $image->md5_hash = $md5; } elseif ($thumbnail != null and $image->thumbnail_file == null) { Clockwork::info('Thumbnail Updated'); $image->thumbnail_file = $randomFilename . '.png'; } $image->save(); return $image; }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(Request $data) { $ip = $data->getClientIp(); Clockwork::info('IP' . $ip); $data = $data->all(); return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'ip_address' => $ip]); }
public function registerMarkupTags() { return ['functions' => ['info' => function ($item) { return Clockwork::info($item); }, 'startEvent' => function ($name, $description = null) { return Clockwork::startEvent($name, $description); }, 'endEvent' => function ($name) { return Clockwork::endEvent($name); }]]; }
public function onRun() { $redirections = Redirection::all(); CW::info($redirections); $url = Request::url(); CW::info($url); foreach ($redirections as $redirect) { // $rule = new RegExp(); if (preg_match($redirect->rule_regexp, $url)) { CW::info(['Redirect' => $redirect]); return Redirect::to($redirect->url, $redirect->redirect_type); } } }
protected function loadPost() { $post = PersonModel::isPublished()->with(['portrait', 'participation.performance', 'featured'])->whereSlug($this->slug)->first(); $post->participation->each(function ($participation) { $participation->performance->setUrl($this->performancePage, $this->controller); if ($participation->type == 'roles') { $this->roles[$participation->performance->id]['url'] = $participation->performance->url; $this->roles[$participation->performance->id]['performance'] = $participation->performance->title; $this->roles[$participation->performance->id]['author'] = $participation->performance->author; $this->roles[$participation->performance->id]['roles'][] = $participation->title; } }); $post['roles'] = $this->roles; if ($post->portrait) { $image = $post->portrait; $image['thumb'] = $image->getThumb(250, 250, 'crop'); } // $post->relation->each(function($relation){ // $relation->setUrl($this->relationPage, $this->controller); // }); CW::info(['post' => $post]); return $post; }
protected function makeImage($file, $height = null, $width = null, $randomFilename, $thumbnail = null, $overrideDeduplication = 'false') { Clockwork::info('Override: ' . $overrideDeduplication); $md5 = md5_file($file->getRealPath()); $img = Image::make($file); if (!($height == null and $width == null)) { Clockwork::info('Fitting Image'); $img->fit($height, $width); } $path = 'images/'; if ($thumbnail != null) { $path = 'images/thumb/'; } $image = Images::where('md5_hash', $md5)->orderBy('id', 'desc')->first(); if ($image === null or $image->thumbnail_file == null or $overrideDeduplication == 'true') { Clockwork::info('Storing on Filesystem'); if ($overrideDeduplication == true) { Clockwork::info('Deduplication Overide'); } $img->save(storage_path() . '/app/' . $path . $randomFilename . '.png', 90); } if (($image === null or $overrideDeduplication == 'true') and $thumbnail === null) { Clockwork::info('New Image'); $image = new Images(); $image->user_id = Auth::user()->id; $image->filename = $file->getClientOriginalName(); $image->file = $randomFilename . '.png'; $image->height = $img->height(); $image->width = $img->width(); $image->md5_hash = $md5; } elseif ($thumbnail != null and $image->thumbnail_file == null) { Clockwork::info('Thumbnail Updated'); $image->thumbnail_file = $randomFilename . '.png'; } $image->save(); return $image; }
public function addReply(Article $b) { $parent = Comment::find(2); $comment = new Comment(); $comment->body = 'MY DICK!'; $comment->user_id = '1'; $b->comments()->save($comment); $comment->makeChildOf($parent); Cache::tags('commentRoot-article-' . $b->id)->flush(); Clockwork::info('Cleared cache:' . 'commentRoot-article-' . $b->id); Cache::forget('commentTree-' . $comment->getRoot()->id); Clockwork::info('Cleared cache: ' . 'commentTree-' . $comment->getRoot()->id); return $comment->getRoot()->id; }
protected function loadPost() { $post = PerformanceModel::isPublished()->Performance()->whereSlug($this->slug)->first(); /* * Add a "URL" helper attribute for linking to each performance and person press */ $this->roles = []; $this->participation = []; $post->participation->each(function ($role) { $role->person->setUrl($this->personPage, $this->controller); if ($role['group'] != null) { $this->roles[$role['group']][] = $role; return; } $this->participation[$role['title']]['title'] = $role->title; $this->participation[$role['title']]['type'] = $role->type; $this->participation[$role['title']]['description'] = $role->description; $this->participation[$role['title']]['group'] = $role->group; $this->participation[$role['title']]['persons'][] = $role->person; }); $post->press->each(function ($press) { $press->setUrl($this->pressPage, $this->controller); }); // ROLES $post->roles = $this->roles; $post->roles_ng = $this->participation; CW::info(['Performance' => $post]); return $post; }
public static function getCategories() { $categories = TaxonomyModel::where('model', get_class())->select('id', 'title', 'slug')->get(); CW::info($categories); return $categories; }