Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

orchidsoftware/platform

4733 stars
2 code files
View orchidsoftware/platform on GitHub

src/Screen/CanSee.php

Open in GitHub
trait CanSee
{
private $display = true;
 
public function canSee(bool $value): self
{
$this->display = $value;
 
return $this;
}
 
public function isSee(): bool
{
return $this->display;
}
}

src/Screen/Cell.php

Open in GitHub
use Closure;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
use Illuminate\Support\Traits\Macroable;
use Orchid\Support\Blade;
 
abstract class Cell
{
use Macroable, CanSee;
 
protected $name;
 
protected $title;
 
protected $render;
 
protected $column;
 
protected $popover;
 
public function __construct(string $name)
{
$this->name = $name;
$this->column = $name;
}
 
public static function make(string $name = '', string $title = null): self
{
$td = new static($name);
$td->column = $name;
$td->title = $title ?? Str::title($name);
 
return $td;
}
 
public function render(\Closure $closure): self
{
$this->render = $closure;
 
return $this;
}
 
public function popover(string $text): self
{
$this->popover = $text;
 
return $this;
}
 
public function component(string $component, string $name = null, array $params = []): self
{
return $this->render(function ($value) use ($component, $name, $params) {
if ($name === null) {
return Blade::renderComponent($component, $value);
}
 
$params[$name] = $value;
 
return Blade::renderComponent($component, $params);
});
}
 
protected function handler($source)
{
return with($source, $this->render);
}
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.