repo
stringlengths
7
63
file_url
stringlengths
81
284
file_path
stringlengths
5
200
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:02:33
2026-01-05 05:24:06
truncated
bool
2 classes
awcodes/filament-badgeable-column
https://github.com/awcodes/filament-badgeable-column/blob/993c1ac7667ad4fffefba0e0e087598264d53b92/tests/src/Feature/ColumnTest.php
tests/src/Feature/ColumnTest.php
<?php declare(strict_types=1); use Awcodes\BadgeableColumn\Tests\Fixtures\Livewire\PostsTable; use Awcodes\BadgeableColumn\Tests\Fixtures\Models\Post; use Awcodes\BadgeableColumn\Tests\TestCase; use function Pest\Livewire\livewire; uses(TestCase::class); it('can render column', function () { Post::factory()->create(); livewire(PostsTable::class) ->assertCanRenderTableColumn('title') ->assertSee('badgeable-column-badge'); });
php
MIT
993c1ac7667ad4fffefba0e0e087598264d53b92
2026-01-05T04:41:05.841685Z
false
awcodes/filament-badgeable-column
https://github.com/awcodes/filament-badgeable-column/blob/993c1ac7667ad4fffefba0e0e087598264d53b92/tests/src/Feature/EntryTest.php
tests/src/Feature/EntryTest.php
<?php declare(strict_types=1); use Awcodes\BadgeableColumn\Tests\Fixtures\Livewire\InfolistPage; use Awcodes\BadgeableColumn\Tests\Fixtures\Models\Post; use Awcodes\BadgeableColumn\Tests\TestCase; use function Pest\Livewire\livewire; uses(TestCase::class); it('can render entry', function () { $post = Post::factory()->create()->refresh(); livewire(InfolistPage::class, ['post' => $post]) ->assertSchemaComponentExists('title') ->assertSee('badgeable-column-badge'); });
php
MIT
993c1ac7667ad4fffefba0e0e087598264d53b92
2026-01-05T04:41:05.841685Z
false
awcodes/filament-badgeable-column
https://github.com/awcodes/filament-badgeable-column/blob/993c1ac7667ad4fffefba0e0e087598264d53b92/tests/src/Feature/DebugTest.php
tests/src/Feature/DebugTest.php
<?php declare(strict_types=1); arch('it will not use debugging functions') ->expect(['dd', 'dump', 'ray']) ->each->not->toBeUsed();
php
MIT
993c1ac7667ad4fffefba0e0e087598264d53b92
2026-01-05T04:41:05.841685Z
false
awcodes/filament-badgeable-column
https://github.com/awcodes/filament-badgeable-column/blob/993c1ac7667ad4fffefba0e0e087598264d53b92/tests/src/Unit/BadgeTest.php
tests/src/Unit/BadgeTest.php
<?php declare(strict_types=1); use Awcodes\BadgeableColumn\Components\Badge; use Awcodes\BadgeableColumn\Tests\TestCase; use Filament\Support\Colors\Color; use Filament\Support\Enums\FontFamily; use Filament\Support\Enums\FontWeight; use Filament\Support\Enums\Size; uses(TestCase::class); beforeEach(function () { $this->component = (new Badge('test')); }); it('has correct color', function (string|array|Closure $color) { $this->component->color($color); expect($this->component) ->getColor()->toBe($color); })->with([ Color::Pink['500'], '#badA55', 'danger', fn () => Color::Slate['500'], ]); it('has correct size', function (string|Closure|Size $size) { $this->component->size($size); expect($this->component) ->getSize()->toBeInstanceOf(Size::class); if ($size instanceof Size) { expect($this->component->getSize())->toBe($size); } else { expect($this->component->getSize()->value)->toBe($size); } })->with([ 'md', fn () => 'lg', Size::ExtraLarge, ]); it('has correct font family', function (string|Closure|FontFamily $family) { $this->component->fontFamily($family); expect($this->component) ->getFontFamily()->toBeInstanceOf(FontFamily::class); if ($family instanceof FontFamily) { expect($this->component->getFontFamily())->toBe($family); } else { expect($this->component->getFontFamily()->value)->toBe($family); } })->with([ 'serif', fn () => 'sans', FontFamily::Mono, ]); it('has correct font weight', function (string|Closure|FontWeight $family) { $this->component->weight($family); expect($this->component) ->getWeight()->toBeInstanceOf(FontWeight::class); if ($family instanceof FontWeight) { expect($this->component->getWeight())->toBe($family); } else { expect($this->component->getWeight()->value)->toBe($family); } })->with([ 'bold', fn () => 'medium', FontWeight::Black, ]);
php
MIT
993c1ac7667ad4fffefba0e0e087598264d53b92
2026-01-05T04:41:05.841685Z
false
awcodes/filament-badgeable-column
https://github.com/awcodes/filament-badgeable-column/blob/993c1ac7667ad4fffefba0e0e087598264d53b92/tests/src/Providers/PostsTableServiceProvider.php
tests/src/Providers/PostsTableServiceProvider.php
<?php declare(strict_types=1); namespace Awcodes\BadgeableColumn\Tests\Providers; use Awcodes\BadgeableColumn\Tests\Fixtures\Livewire\PostsTable; use Illuminate\Support\ServiceProvider; use Livewire\Livewire; use Livewire\Mechanisms\ComponentRegistry; class PostsTableServiceProvider extends ServiceProvider { public function boot(): void { Livewire::component(app(ComponentRegistry::class) ->getName(PostsTable::class), PostsTable::class); } }
php
MIT
993c1ac7667ad4fffefba0e0e087598264d53b92
2026-01-05T04:41:05.841685Z
false
awcodes/filament-badgeable-column
https://github.com/awcodes/filament-badgeable-column/blob/993c1ac7667ad4fffefba0e0e087598264d53b92/tests/database/factories/PostFactory.php
tests/database/factories/PostFactory.php
<?php declare(strict_types=1); namespace Awcodes\BadgeableColumn\Tests\Database\Factories; use Awcodes\BadgeableColumn\Tests\Fixtures\Models\Post; use Illuminate\Database\Eloquent\Factories\Factory; class PostFactory extends Factory { protected $model = Post::class; public function definition(): array { return [ 'title' => $this->faker->sentence(), 'content' => $this->faker->paragraph(), 'is_published' => $this->faker->boolean(), ]; } }
php
MIT
993c1ac7667ad4fffefba0e0e087598264d53b92
2026-01-05T04:41:05.841685Z
false
awcodes/filament-badgeable-column
https://github.com/awcodes/filament-badgeable-column/blob/993c1ac7667ad4fffefba0e0e087598264d53b92/tests/database/migrations/create_posts_table.php
tests/database/migrations/create_posts_table.php
<?php declare(strict_types=1); use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { public function up(): void { Schema::create('posts', function (Blueprint $table): void { $table->id(); $table->string('title'); $table->text('content')->nullable(); $table->boolean('is_published')->default(true); $table->timestamps(); }); } public function down(): void { Schema::dropIfExists('posts'); } };
php
MIT
993c1ac7667ad4fffefba0e0e087598264d53b92
2026-01-05T04:41:05.841685Z
false
awcodes/filament-badgeable-column
https://github.com/awcodes/filament-badgeable-column/blob/993c1ac7667ad4fffefba0e0e087598264d53b92/resources/views/components/badge.blade.php
resources/views/components/badge.blade.php
@use('Filament\Support\Enums\FontFamily') @use('Filament\Support\Enums\FontWeight') @use('Filament\Support\Enums\Size') @use('Illuminate\Support\Arr') @if (! $isHidden()) @php $color = $getColor(); $size = match ($size = $getSize()) { Size::ExtraSmall, 'xs' => 'xs', Size::Small, 'sm', null => 'sm', Size::Medium, 'base', 'md' => 'md', Size::Large, 'lg' => 'lg', Size::ExtraLarge, 'xl' => 'xl', default => $size, }; $badgeClasses = Arr::toCssClasses([ "badgeable-column-badge", match ($shouldBePill()) { true => 'px-2 !rounded-full', default => null, }, match ($getFontFamily()) { FontFamily::Sans, 'sans' => 'font-sans', FontFamily::Serif, 'serif' => 'font-serif', FontFamily::Mono, 'mono' => 'font-mono', default => null, }, match ($getWeight() ?? 'medium') { FontWeight::Thin, 'thin' => 'font-thin', FontWeight::ExtraLight, 'extralight' => 'font-extralight', FontWeight::Light, 'light' => 'font-light', FontWeight::Medium, 'medium' => 'font-medium', FontWeight::SemiBold, 'semibold' => 'font-semibold', FontWeight::Bold, 'bold' => 'font-bold', FontWeight::ExtraBold, 'extrabold' => 'font-extrabold', FontWeight::Black, 'black' => 'font-black', default => null, } ]); @endphp <x-filament::badge :class="$badgeClasses" :color="$color" :size="$size"> {{ $getLabel() }} </x-filament::badge> @endif
php
MIT
993c1ac7667ad4fffefba0e0e087598264d53b92
2026-01-05T04:41:05.841685Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/app/autoload.php
app/autoload.php
<?php if (!$loader = include __DIR__.'/../vendor/autoload.php') { $nl = PHP_SAPI === 'cli' ? PHP_EOL : '<br />'; echo "$nl$nl"; if (is_writable(dirname(__DIR__)) && $installer = @file_get_contents('http://getcomposer.org/installer')) { echo 'You must set up the project dependencies.'.$nl; $installerPath = dirname(__DIR__).'/install-composer.php'; file_put_contents($installerPath, $installer); echo 'The composer installer has been downloaded in '.$installerPath.$nl; die('Run the following commands in '.dirname(__DIR__).':'.$nl.$nl. 'php install-composer.php'.$nl. 'php composer.phar install'.$nl); } die('You must set up the project dependencies.'.$nl. 'Run the following commands in '.dirname(__DIR__).':'.$nl.$nl. 'curl -s http://getcomposer.org/installer | php'.$nl. 'php composer.phar install'.$nl); } use Doctrine\Common\Annotations\AnnotationRegistry; // intl if (!function_exists('intl_get_error_code')) { require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php'; $loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs'); } AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/app/AppKernel.php
app/AppKernel.php
<?php use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; class AppKernel extends Kernel { public function registerBundles() { $bundles = array( new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(), new JMS\AopBundle\JMSAopBundle(), new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), new Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle(), new Knp\Bundle\MenuBundle\KnpMenuBundle(), new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), new FOS\UserBundle\FOSUserBundle(), new Liip\ImagineBundle\LiipImagineBundle(), new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(), new Knp\IpsumBundle\KnpIpsumBundle(), new JMS\DiExtraBundle\JMSDiExtraBundle($this) ); if (in_array($this->getEnvironment(), array('dev', 'test'))) { $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); } return $bundles; } public function registerContainerConfiguration(LoaderInterface $loader) { $loader->load($this->getLocalConfigurationFile($this->getEnvironment())); } /** * Returns the config_{environment}_local.yml file or * the default config_{environment}.yml if it does not exist. * Useful to override development password. * * @param string Environment * @return The configuration file path */ protected function getLocalConfigurationFile($environment) { $basePath = __DIR__.'/config/config_'; $file = $basePath.$environment.'_local.yml'; if(\file_exists($file)) { return $file; } return $basePath.$environment.'.yml'; } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/app/AppCache.php
app/AppCache.php
<?php require_once __DIR__.'/AppKernel.php'; use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache; class AppCache extends HttpCache { }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/app/check.php
app/check.php
<?php if (!$iniPath = get_cfg_var('cfg_file_path')) { $iniPath = 'WARNING: not using a php.ini file'; } echo "********************************\n"; echo "* *\n"; echo "* Symfony requirements check *\n"; echo "* *\n"; echo "********************************\n\n"; echo sprintf("php.ini used by PHP: %s\n\n", $iniPath); echo "** WARNING **\n"; echo "* The PHP CLI can use a different php.ini file\n"; echo "* than the one used with your web server.\n"; if ('\\' == DIRECTORY_SEPARATOR) { echo "* (especially on the Windows platform)\n"; } echo "* If this is the case, please ALSO launch this\n"; echo "* utility from your web server.\n"; echo "** WARNING **\n"; // mandatory echo_title("Mandatory requirements"); check(version_compare(phpversion(), '5.3.2', '>='), sprintf('Checking that PHP version is at least 5.3.2 (%s installed)', phpversion()), 'Install PHP 5.3.2 or newer (current version is '.phpversion(), true); check(ini_get('date.timezone'), 'Checking that the "date.timezone" setting is set', 'Set the "date.timezone" setting in php.ini (like Europe/Paris)', true); check(is_writable(__DIR__.'/../app/cache'), sprintf('Checking that app/cache/ directory is writable'), 'Change the permissions of the app/cache/ directory so that the web server can write in it', true); check(is_writable(__DIR__.'/../app/logs'), sprintf('Checking that the app/logs/ directory is writable'), 'Change the permissions of the app/logs/ directory so that the web server can write in it', true); check(function_exists('json_encode'), 'Checking that the json_encode() is available', 'Install and enable the json extension', true); check(class_exists('SQLite3') || in_array('sqlite', PDO::getAvailableDrivers()), 'Install and enable the SQLite3 or PDO_SQLite extension.', true); // warnings echo_title("Optional checks"); check(class_exists('DomDocument'), 'Checking that the PHP-XML module is installed', 'Install and enable the php-xml module', false); check(defined('LIBXML_COMPACT'), 'Checking that the libxml version is at least 2.6.21', 'Upgrade your php-xml module with a newer libxml', false); check(function_exists('token_get_all'), 'Checking that the token_get_all() function is available', 'Install and enable the Tokenizer extension (highly recommended)', false); check(function_exists('mb_strlen'), 'Checking that the mb_strlen() function is available', 'Install and enable the mbstring extension', false); check(function_exists('iconv'), 'Checking that the iconv() function is available', 'Install and enable the iconv extension', false); check(function_exists('utf8_decode'), 'Checking that the utf8_decode() is available', 'Install and enable the XML extension', false); if (PHP_OS != 'WINNT') { check(function_exists('posix_isatty'), 'Checking that the posix_isatty() is available', 'Install and enable the php_posix extension (used to colorized the CLI output)', false); } check(class_exists('Locale'), 'Checking that the intl extension is available', 'Install and enable the intl extension (used for validators)', false); if (class_exists('Locale')) { $version = ''; if (defined('INTL_ICU_VERSION')) { $version = INTL_ICU_VERSION; } else { $reflector = new \ReflectionExtension('intl'); ob_start(); $reflector->info(); $output = ob_get_clean(); preg_match('/^ICU version => (.*)$/m', $output, $matches); $version = $matches[1]; } check(version_compare($matches[1], '4.0', '>='), 'Checking that the intl ICU version is at least 4+', 'Upgrade your intl extension with a newer ICU version (4+)', false); } $accelerator = (function_exists('apc_store') && ini_get('apc.enabled')) || function_exists('eaccelerator_put') && ini_get('eaccelerator.enable') || function_exists('xcache_set') ; check($accelerator, 'Checking that a PHP accelerator is installed', 'Install a PHP accelerator like APC (highly recommended)', false); check(!ini_get('short_open_tag'), 'Checking that php.ini has short_open_tag set to off', 'Set short_open_tag to off in php.ini', false); check(!ini_get('magic_quotes_gpc'), 'Checking that php.ini has magic_quotes_gpc set to off', 'Set magic_quotes_gpc to off in php.ini', false); check(!ini_get('register_globals'), 'Checking that php.ini has register_globals set to off', 'Set register_globals to off in php.ini', false); check(!ini_get('session.auto_start'), 'Checking that php.ini has session.auto_start set to off', 'Set session.auto_start to off in php.ini', false); echo_title("Optional checks (Doctrine)"); check(class_exists('PDO'), 'Checking that PDO is installed', 'Install PDO (mandatory for Doctrine)', false); if (class_exists('PDO')) { $drivers = PDO::getAvailableDrivers(); check(count($drivers), 'Checking that PDO has some drivers installed: '.implode(', ', $drivers), 'Install PDO drivers (mandatory for Doctrine)'); } /** * Checks a configuration. */ function check($boolean, $message, $help = '', $fatal = false) { echo $boolean ? " OK " : sprintf("\n\n[[%s]] ", $fatal ? ' ERROR ' : 'WARNING'); echo sprintf("$message%s\n", $boolean ? '' : ': FAILED'); if (!$boolean) { echo " *** $help ***\n"; if ($fatal) { die("You must fix this problem before resuming the check.\n"); } } } function echo_title($title) { echo "\n** $title **\n\n"; }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/KnpIpsumBundle.php
src/Knp/IpsumBundle/KnpIpsumBundle.php
<?php namespace Knp\IpsumBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; class KnpIpsumBundle extends Bundle { }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Entity/TimedThing.php
src/Knp/IpsumBundle/Entity/TimedThing.php
<?php namespace Knp\IpsumBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; /** * Knp\IpsumBundle\Entity\TimedThing * * @ORM\Table() * @ORM\Entity */ class TimedThing { /** * @var integer $id * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var string * * @ORM\Column(name="name", type="string", length=255) */ private $name; /** * @var string * * @ORM\Column(name="content", type="string", length=255) */ private $content; /** * This field is populated automatically when persisting an entity * in the database. * * @var \DateTime * * @ORM\Column(name="createdAt", type="datetime") * @Gedmo\Timestampable(on="create") */ private $createdAt; /** * This field is populated automatically when updating the entity. * * @var \DateTime * * @ORM\Column(name="updatedAt", type="datetime") * @Gedmo\Timestampable(on="update") */ private $updatedAt; /** * Constructor * */ function __construct() { $now = new \DateTime(); $this->setCreatedAt($now); $this->setUpdatedAt($now); } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set name * * @param string $name */ public function setName($name) { $this->name = $name; } /** * Get name * * @return string */ public function getName() { return $this->name; } /** * Set content * * @param string $content */ public function setContent($content) { $this->content = $content; } /** * Get content * * @return string */ public function getContent() { return $this->content; } /** * Set createdAt * * @param \DateTime $createdAt */ public function setCreatedAt(\DateTime $createdAt) { $this->createdAt = $createdAt; } /** * Get createdAt * * @return \DateTime */ public function getCreatedAt() { return $this->createdAt; } /** * Set updatedAt * * @param \DateTime $updatedAt */ public function setUpdatedAt(\DateTime $updatedAt) { $this->updatedAt = $updatedAt; } /** * Get updatedAt * * @return \DateTime */ public function getUpdatedAt() { return $this->updatedAt; } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Entity/User.php
src/Knp/IpsumBundle/Entity/User.php
<?php namespace Knp\IpsumBundle\Entity; use FOS\UserBundle\Entity\User as BaseUser; use Doctrine\ORM\Mapping as ORM; /** * Knp\IpsumBundle\Entity\User * * @ORM\Table(name="fos_user") * @ORM\Entity */ class User extends BaseUser { /** * @var integer * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Entity/Category.php
src/Knp/IpsumBundle/Entity/Category.php
<?php namespace Knp\IpsumBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\ArrayCollection; /** * @ORM\Entity */ class Category { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM\Column(type="string", length=255) */ protected $name; /** * @ORM\OneToMany(targetEntity="Knp\IpsumBundle\Entity\Thing", mappedBy="category") */ protected $things; public function __construct() { $this->things = new ArrayCollection(); } /** * Get id * * @return string */ public function getId() { return $this->id; } /** * Set name * * @param string $name */ public function setName($name) { $this->name = $name; } /** * Get name * * @return string */ public function getName() { return $this->name; } public function __toString() { return $this->name; } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Entity/Thing.php
src/Knp/IpsumBundle/Entity/Thing.php
<?php namespace Knp\IpsumBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity(repositoryClass="Knp\IpsumBundle\Repository\ThingRepository") */ class Thing { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM\Column(type="string", length=255) */ protected $name; /** * @ORM\ManyToOne(targetEntity="Knp\IpsumBundle\Entity\Category", inversedBy="things") * @ORM\JoinColumn(name="category_id", referencedColumnName="id") */ protected $category; /** * Dummy method to show you that you can create methods * * @return string */ public function identifyYourselfPlease() { $categoryName = $this->getCategory() ? $this->getCategory()->getName() : "(null)"; return $this->getName().' in category '.$categoryName; } /** * Get id * * @return string */ public function getId() { return $this->id; } /** * Set name * * @param string $name */ public function setName($name) { $this->name = $name; } /** * Get name * * @return string */ public function getName() { return $this->name; } /** * Set category * * @param Category $category */ public function setCategory($category) { $this->category = $category; } /** * Get category * * @return Category */ public function getCategory() { return $this->category; } public function __toString() { return $this->identifyYourselfPlease(); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Controller/TwigController.php
src/Knp/IpsumBundle/Controller/TwigController.php
<?php namespace Knp\IpsumBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class TwigController extends Controller { public function helloAction($name) { return $this->render('KnpIpsumBundle:Twig:hello.html.twig', array( 'name' => $name )); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Controller/KnpMenuController.php
src/Knp/IpsumBundle/Controller/KnpMenuController.php
<?php namespace Knp\IpsumBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class KnpMenuController extends Controller { public function indexAction($name) { return $this->render('KnpIpsumBundle:KnpMenu:index.html.twig', array( 'name' => $name )); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Controller/SwiftmailerController.php
src/Knp/IpsumBundle/Controller/SwiftmailerController.php
<?php namespace Knp\IpsumBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class SwiftmailerController extends Controller { public function indexAction() { return $this->render('KnpIpsumBundle:SwiftMailer:index.html.twig'); } public function sendAction() { $email = $this->get('request')->query->get('email', 'nope@localhost.com'); $vars = array('time' => date('H:i:s')); $message = \Swift_Message::newInstance() ->setSubject('Hello Email') ->setFrom('me@localhost.com') ->setTo($email) ->setBody($this->renderView('KnpIpsumBundle:SwiftMailer:email.html.twig', $vars), 'text/html') ->addPart($this->renderView('KnpIpsumBundle:SwiftMailer:email.txt.twig', $vars), 'text/plain') ; $this->get('mailer')->send($message); return $this->render('KnpIpsumBundle:SwiftMailer:send.html.twig'); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Controller/JMSSecurityExtraController.php
src/Knp/IpsumBundle/Controller/JMSSecurityExtraController.php
<?php namespace Knp\IpsumBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use JMS\SecurityExtraBundle\Annotation\Secure; class JMSSecurityExtraController extends Controller { public function indexAction() { return $this->render('KnpIpsumBundle:JMSSecurityExtra:index.html.twig'); } /** * @Secure(roles="ROLE_ADMIN") */ public function adminAction() { return $this->render('KnpIpsumBundle:JMSSecurityExtra:admin.html.twig'); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Controller/DoctrineOrmController.php
src/Knp/IpsumBundle/Controller/DoctrineOrmController.php
<?php namespace Knp\IpsumBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Knp\IpsumBundle\Entity\Thing; use Knp\IpsumBundle\Entity\Category; class DoctrineOrmController extends Controller { public function indexAction() { $em = $this->get('doctrine')->getEntityManager(); $things = $em->getRepository('KnpIpsumBundle:Thing')->findAll(); return $this->render('KnpIpsumBundle:DoctrineOrm:index.html.twig', array( 'things' => $things, )); } public function customRepositoryAction() { $text = $this->get('request')->query->get('q', ''); $em = $this->get('doctrine')->getEntityManager(); $things = $em->getRepository('KnpIpsumBundle:Thing')->findAllWhoseNameContains($text); return $this->render('KnpIpsumBundle:DoctrineOrm:custom_repository.html.twig', array( 'things' => $things, 'text' => $text, )); } public function createAction() { $em = $this->get('doctrine')->getEntityManager(); // Let's create a new thing $thing = new Thing(); $thing->setName('Lorem'.\uniqid()); // This does not actually save the entity but rather mark it // as "should-be-saved-on-the-next-flush" $em->persist($thing); // ... and let's create a new category! // Yes sir, we are in a good mood today. $category = new Category(); $category->setName('Category'.\uniqid()); $thing->setCategory($category); $em->persist($category); // Now we save everything: let's flush! $em->flush(); return $this->render('KnpIpsumBundle:DoctrineOrm:create.html.twig', array( 'thing' => $thing, )); } public function deleteAction($id) { // Here we are only showing how you can delete an entity // In real life, a GET query should not create or delete your data // You should use a form and a POST // If you don't get why, the internet has the answer you're looking for $em = $this->get('doctrine')->getEntityManager(); $thing = $em->getRepository('KnpIpsumBundle:Thing')->find($id); if (!$thing) { throw $this->createNotFoundException("Thing with id '$id' not found"); } $em->remove($thing); $em->flush(); return $this->render('KnpIpsumBundle:DoctrineOrm:delete.html.twig'); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Controller/FormController.php
src/Knp/IpsumBundle/Controller/FormController.php
<?php namespace Knp\IpsumBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\RedirectResponse; use Knp\IpsumBundle\Form\Type\ContactType; use Knp\IpsumBundle\Form\Model\Contact; use Symfony\Component\HttpFoundation\File\UploadedFile; class FormController extends Controller { public function contactAction() { $contact = new Contact(); $form = $this->createForm(new ContactType(), $contact); $request = $this->container->get('request'); if ('POST' === $request->getMethod()) { $form->bindRequest($request); if ($form->isValid()) { $file = $form['attachment']->getData(); if ($file) { $file->move($contact->getUploadDir(), $contact->generateRandomFileName($file)); } $ret = $contact->dummySend(); $this->get('session')->setFlash('notice', $ret); return new RedirectResponse($this->generateUrl('knp_ipsum')); } } return $this->render('KnpIpsumBundle:Form:contact.html.twig', array( 'form' => $form->createView(), )); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Controller/SecuredController.php
src/Knp/IpsumBundle/Controller/SecuredController.php
<?php namespace Knp\IpsumBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\Security\Core\SecurityContext; class SecuredController extends Controller { public function indexAction() { return $this->render('KnpIpsumBundle:Secured:index.html.twig'); } public function adminAction() { // The security layer will intercept this request if the user is not an admin return $this->render('KnpIpsumBundle:Secured:admin.html.twig'); } public function loginAction() { if ($this->get('request')->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) { $error = $this->get('request')->attributes->get(SecurityContext::AUTHENTICATION_ERROR); } else { $error = $this->get('request')->getSession()->get(SecurityContext::AUTHENTICATION_ERROR); } return $this->render('KnpIpsumBundle:Secured:login.html.twig', array( 'last_username' => $this->get('request')->getSession()->get(SecurityContext::LAST_USERNAME), 'error' => $error, )); } public function securityCheckAction() { // The security layer will intercept this request } public function logoutAction() { // The security layer will intercept this request } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Controller/LiipImagineController.php
src/Knp/IpsumBundle/Controller/LiipImagineController.php
<?php namespace Knp\IpsumBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class LiipImagineController extends Controller { public function indexAction() { return $this->render('KnpIpsumBundle:LiipImagine:index.html.twig'); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Controller/SensioFrameworkExtraController.php
src/Knp/IpsumBundle/Controller/SensioFrameworkExtraController.php
<?php namespace Knp\IpsumBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; /** * @Route("/sensio-frameworkextra") */ class SensioFrameworkExtraController extends Controller { /** * @Route("/", name="knp_ipsum_sensio_frameworkextra") * @Template() */ public function indexAction() { return array(); } /** * @Route("/hello/{name}", name="knp_ipsum_sensio_frameworkextra_hello") * @Template() */ public function helloAction($name) { return array('name' => $name); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Controller/AsseticController.php
src/Knp/IpsumBundle/Controller/AsseticController.php
<?php namespace Knp\IpsumBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class AsseticController extends Controller { public function indexAction() { return $this->render('KnpIpsumBundle:Assetic:index.html.twig'); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Controller/DoctrineOdmController.php
src/Knp/IpsumBundle/Controller/DoctrineOdmController.php
<?php namespace Knp\IpsumBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Knp\IpsumBundle\Document\Product; use Knp\IpsumBundle\Document\Category; class DoctrineOdmController extends Controller { public function indexAction() { $dm = $this->get('doctrine.odm.mongodb.document_manager'); $products = $dm->getRepository('KnpIpsumBundle:Product')->findAll(); return $this->render('KnpIpsumBundle:DoctrineOdm:index.html.twig', array( 'products' => $products, )); } public function createAction() { $dm = $this->get('doctrine.odm.mongodb.document_manager'); // Let's create a new product $product = new Product(); $product->setName('Lorem'.\uniqid()); $dm->persist($product); //Lets create a new category $category = new Category(); $category->setName('Category'.\uniqid()); $product->setCategory($category); $dm->flush(); return $this->render('KnpIpsumBundle:DoctrineOdm:create.html.twig', array( 'product' => $product, )); } public function deleteAction($id) { // Here we are only showing how you can delete an entity // In real life, a GET query should not create or delete your data // You should use a form and a POST // If you don't get why, the internet has the answer you're looking for $dm = $this->get('doctrine.odm.mongodb.document_manager'); $product = $dm->getRepository('KnpIpsumBundle:Product')->find($id); if (!$product) { throw $this->createNotFoundException("Product with id '$id' not found"); } $dm->remove($product); $dm->flush(); return $this->render('KnpIpsumBundle:DoctrineOdm:delete.html.twig'); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Controller/SummaryController.php
src/Knp/IpsumBundle/Controller/SummaryController.php
<?php namespace Knp\IpsumBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class SummaryController extends Controller { public function indexAction() { return $this->render('KnpIpsumBundle:Summary:index.html.twig'); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Controller/KnpPaginatorController.php
src/Knp/IpsumBundle/Controller/KnpPaginatorController.php
<?php namespace Knp\IpsumBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Pagerfanta\Pagerfanta; use Pagerfanta\Adapter\DoctrineORMAdapter; class KnpPaginatorController extends Controller { public function indexAction() { $em = $this->get('doctrine')->getEntityManager(); /* @var $em \Doctrine\ORM\EntityManager */ $query = $em->createQuery('SELECT t FROM KnpIpsumBundle:Thing t'); $paginator = $this->get('knp_paginator'); $pagination = $paginator->paginate( $query, $this->get('request')->query->get('page', 1)/*page number*/, 10/*limit per page*/ ); return $this->render('KnpIpsumBundle:KnpPaginator:index.html.twig', array( 'pagination' => $pagination, )); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Controller/GedmoExtensionsController.php
src/Knp/IpsumBundle/Controller/GedmoExtensionsController.php
<?php namespace Knp\IpsumBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Knp\IpsumBundle\Entity\TimedThing; class GedmoExtensionsController extends Controller { public function indexAction() { $em = $this->get('doctrine')->getEntityManager(); $things = $em->getRepository('KnpIpsumBundle:TimedThing')->findAll(); return $this->render('KnpIpsumBundle:GedmoExtensions:index.html.twig', array( 'things' => $things, )); } public function createAction() { $em = $this->get('doctrine')->getEntityManager(); // Let's create a new timed thing // note that we don't set the creation date. It will be added // automatically by the Doctrine extension based on the // mapping. $thing = new TimedThing(); $thing->setName('Lorem '.uniqid()); $thing->setContent('Lorem ipsum '.uniqid()); // This does not actually save the entity but rather mark it // as "should-be-saved-on-the-next-flush" $em->persist($thing); // Now we save everything: let's flush! $em->flush(); return $this->render('KnpIpsumBundle:GedmoExtensions:create.html.twig', array( 'thing' => $thing, )); } public function updateAction($id) { $em = $this->get('doctrine')->getEntityManager(); $thing = $em->getRepository('KnpIpsumBundle:TimedThing')->find($id); if (!$thing) { throw $this->createNotFoundException("TimedThing with id '$id' not found"); } // Note that we don't update the updatedAt field. this will be // done automatically by the Doctrine extension based on the // mapping. $thing->setContent('Lorem ipsum '.uniqid().' updated'); $em->flush(); return $this->render('KnpIpsumBundle:GedmoExtensions:update.html.twig', array( 'thing' => $thing, )); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Document/Product.php
src/Knp/IpsumBundle/Document/Product.php
<?php namespace Knp\IpsumBundle\Document; use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB; /** * @MongoDB\Document(repositoryClass="Knp\IpsumBundle\Document\Repository\ProductRepository") */ class Product { /** * @MongoDB\Id */ protected $id; /** * @MongoDB\String */ protected $name; /** * @MongoDB\ReferenceOne(targetDocument="Knp\IpsumBundle\Document\Category", cascade={"persist"}) */ protected $category; /** * Dummy method to show you that you can create methods * * @return string */ public function identifyYourselfPlease() { $categoryName = $this->getCategory() ? $this->getCategory()->getName() : "(null)"; return $this->getName().' in category '.$categoryName; } /** * Get id * * @return id $id */ public function getId() { return $this->id; } /** * Set name * * @param string $name */ public function setName($name) { $this->name = $name; } /** * Get name * * @return string $name */ public function getName() { return $this->name; } /** * Set category * * @param Knp\IpsumBundle\Document\Category $category */ public function setCategory(\Knp\IpsumBundle\Document\Category $category) { $this->category = $category; } /** * Get category * * @return Knp\IpsumBundle\Document\Category $category */ public function getCategory() { return $this->category; } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Document/Category.php
src/Knp/IpsumBundle/Document/Category.php
<?php namespace Knp\IpsumBundle\Document; use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB; /** * @MongoDB\Document */ class Category { /** * @MongoDB\Id */ protected $id; /** * @MongoDB\String */ protected $name; /** * @MongoDB\ReferenceMany(targetDocument="Knp\IpsumBundle\Document\Product", cascade={"persist"}) */ protected $product = array(); public function __construct() { $this->product = new \Doctrine\Common\Collections\ArrayCollection(); } /** * Get id * * @return id $id */ public function getId() { return $this->id; } /** * Set name * * @param string $name */ public function setName($name) { $this->name = $name; } /** * Get name * * @return string $name */ public function getName() { return $this->name; } /** * Add product * * @param Knp\IpsumBundle\Document\Product $product */ public function addProduct(\Knp\IpsumBundle\Document\Product $product) { $this->product[] = $product; } /** * Get product * * @return Doctrine\Common\Collections\Collection $product */ public function getProduct() { return $this->product; } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Document/Repository/ProductRepository.php
src/Knp/IpsumBundle/Document/Repository/ProductRepository.php
<?php namespace Knp\IpsumBundle\Document\Repository; use Doctrine\ODM\MongoDB\DocumentRepository; /** * ProductRepository * * This class was generated by the Doctrine ORM. Add your own custom * repository methods below. */ class ProductRepository extends DocumentRepository { }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Twig/Extension/IpsumExtension.php
src/Knp/IpsumBundle/Twig/Extension/IpsumExtension.php
<?php namespace Knp\IpsumBundle\Twig\Extension; use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Bundle\TwigBundle\Loader\FilesystemLoader; class IpsumExtension extends \Twig_Extension { protected $loader; protected $controller; protected $environment; public function __construct(FilesystemLoader $loader, $environment) { $this->loader = $loader; $this->environment = $environment; } public function setController($controller) { $this->controller = $controller; } /** * {@inheritdoc} */ public function getFunctions() { return array( 'code' => new \Twig_Function_Method($this, 'getCode', array('is_safe' => array('html'))), ); } protected function cleanCode($code) { return rtrim(preg_replace('@^( *\n)*(.*)@s', '$2', htmlspecialchars($code, ENT_QUOTES, 'UTF-8')), "\n\t \r"); } public function getCode($template) { if ('test' === $this->environment) { return; } $controllerPath = $this->getControllerPath(); $templatePath = $this->getTemplatePath($template); $controller = preg_replace('/^\s{4}/m', '', $this->cleanCode($this->getControllerCode())); $template = $this->getTemplateCode($template); // remove the code block $template = str_replace('{% set code = code(_self) %}', '', $template); $template = $this->cleanCode($template); $featureName = preg_replace('/^.*Controller\/([^\/]+)Controller\.php\:\d+$/', '$1', $controllerPath); $featurePath = realpath(__DIR__ . '/../../Features/'.$featureName.'.feature'); if (file_exists($featurePath)) { $feature = htmlspecialchars(file_get_contents($featurePath), ENT_QUOTES, 'UTF-8'); $featurePath = preg_replace('/^.*(src\/Knp\/IpsumBundle\/Features)/', '$1', $featurePath); $featureContent = <<<FEATURE <h1>User Story</h1> <span class="code_path">$featurePath</span> <pre class="code_block"><code>$feature</code></pre> FEATURE; } else { $featureContent = ''; } return <<<EOF $featureContent <h1>Controller Code</h1> <span class="code_path">$controllerPath</span> <pre class="code_block"><code>$controller</code></pre> <h1>Template Code</h1> <span class="code_path">$templatePath</span> <pre class="code_block"><code>$template</code></pre> EOF; } protected function getControllerCode() { $r = new \ReflectionClass($this->controller[0]); $m = $r->getMethod($this->controller[1]); $code = file($r->getFilename()); return ' '.$m->getDocComment()."\n".implode('', array_slice($code, $m->getStartline() - 1, $m->getEndLine() - $m->getStartline() + 1)); } protected function getControllerPath() { $r = new \ReflectionClass($this->controller[0]); $m = $r->getMethod($this->controller[1]); return preg_replace('/^.*(src\/Knp\/IpsumBundle\/Controller)/', '$1', $r->getFilename()) . ':' . $m->getStartline(); } protected function getTemplateCode($template) { return $this->loader->getSource($template->getTemplateName()); } protected function getTemplatePath($template) { return preg_replace('/Knp([^:]+)\:([^:]+)\:/', 'src/Knp/$1/Resources/views/$2/', $template->getTemplateName()); } /** * Returns the name of the extension. * * @return string The extension name */ public function getName() { return 'ipsum'; } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Form/Model/Contact.php
src/Knp/IpsumBundle/Form/Model/Contact.php
<?php namespace Knp\IpsumBundle\Form\Model; use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\HttpFoundation\File\UploadedFile; class Contact { /** * Message * * @var string * @Assert\NotBlank() */ protected $message; /** * Email * * @var string * @Assert\NotBlank() * @Assert\Email() */ protected $email; /** * Attachment * * @var string * @Assert\File(maxSize="2000000") */ protected $attachment; protected $upload_dir = '/tmp/'; /** * Dummy function to do something in this model * * @return string */ public function dummySend() { return sprintf('Here I could be sending your "%s" message from %s with %s as attachment.', $this->getMessage(), $this->getEmail(), $this->getAttachment() ); } /** * @return string */ public function getEmail() { return $this->email; } /** * @param string $email */ public function setEmail($email) { $this->email = $email; } /** * @return string */ public function getMessage() { return $this->message; } /** * @param string $message */ public function setMessage($message) { $this->message = $message; } /** * @return string */ public function getAttachment() { return $this->attachment ?: 'nothing'; } /** * @param $attachment */ public function setAttachment($attachment) { $this->attachment = $attachment; } public function getUploadDir() { return $this->upload_dir; } /** * @param \Symfony\Component\HttpFoundation\File\UploadedFile $file * @return string */ public function generateRandomFileName(UploadedFile $file) { $extension = $file->guessExtension(); if (!$extension) { // extension cannot be guessed $extension = 'bin'; } $this->attachment = rand(1, 999999).'-'.time().'.'.$extension; return $this->attachment; } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Form/Type/ContactType.php
src/Knp/IpsumBundle/Form/Type/ContactType.php
<?php namespace Knp\IpsumBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; class ContactType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('email', 'text', array('required' => true, 'label' => 'Your email:')); $builder->add('message', 'textarea', array('required' => true, 'label' => 'Your delightful message:')); $builder->add('attachment', 'file', array('data_class' => null, 'required' => false, 'label' => 'Your attachment:')); } public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'data_class' => 'Knp\IpsumBundle\Form\Model\Contact', )); } public function getName() { return 'knpipsumbundle_contact'; } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/DependencyInjection/KnpIpsumExtension.php
src/Knp/IpsumBundle/DependencyInjection/KnpIpsumExtension.php
<?php namespace Knp\IpsumBundle\DependencyInjection; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\Config\FileLocator; class KnpIpsumExtension extends Extension { public function load(array $configs, ContainerBuilder $container) { $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.xml'); $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('menus.yml'); } public function getAlias() { return 'knp_ipsum'; } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Menu/IpsumMenu.php
src/Knp/IpsumBundle/Menu/IpsumMenu.php
<?php namespace Knp\IpsumBundle\Menu; use Knp\Bundle\MenuBundle\Menu; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Router; class IpsumMenu extends Menu { /** * @param Request $request * @param Router $router */ public function __construct(Request $request, Router $router) { parent::__construct(array( 'id' => 'nav-ipsum', 'class' => 'menu' )); $this->setCurrentUri($request->getRequestUri()); $this->addChild('menu', $router->generate('knp_ipsum_knp_menu'))->setLabel("KnpMenuBundle"); $this->addChild('menu-john', $router->generate('knp_ipsum_knp_menu', array('name' => "John")))->setLabel("KnpMenuBundle with John"); $this->addChild('menu-bob', $router->generate('knp_ipsum_knp_menu', array('name' => "Bob")))->setLabel("KnpMenuBundle with Bob"); $this->addChild('menu-bill', $router->generate('knp_ipsum_knp_menu', array('name' => "Bill")))->setLabel("KnpMenuBundle with Bill"); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Menu/MenuBuilder.php
src/Knp/IpsumBundle/Menu/MenuBuilder.php
<?php namespace Knp\IpsumBundle\Menu; use Knp\Menu\FactoryInterface; use Symfony\Component\HttpFoundation\Request; class MenuBuilder { private $factory; /** * @param FactoryInterface $factory */ public function __construct(FactoryInterface $factory) { $this->factory = $factory; } /** * @param Request $request */ public function createDemoMenu(Request $request) { $menu = $this->factory->createItem('root', array( 'id' => 'nav-ipsum', 'class' => 'menu' )); $menu->setCurrentUri($request->getRequestUri()); $menu->addChild('menu', array('route' => 'knp_ipsum_knp_menu'))->setLabel("KnpMenuBundle"); $menu->addChild('menu-john', array('route' => 'knp_ipsum_knp_menu', 'routeParameters' => array('name' => "John")))->setLabel("KnpMenuBundle with John"); $menu->addChild('menu-bob', array('route' => 'knp_ipsum_knp_menu', 'routeParameters' => array('name' => "Bob")))->setLabel("KnpMenuBundle with Bob"); $menu->addChild('menu-bill', array('route' => 'knp_ipsum_knp_menu', 'routeParameters' => array('name' => "Bill")))->setLabel("KnpMenuBundle with Bill"); return $menu; } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Tests/Controller/IpsumControllerTest.php
src/Knp/IpsumBundle/Tests/Controller/IpsumControllerTest.php
<?php namespace Knp\IpsumBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class IpsumControllerTest extends WebTestCase { public function testIndex() { $client = self::createClient(); $crawler = $client->request('GET', '/twig/Edgar'); $this->assertTrue($crawler->filter('html:contains("Hello Edgar")')->count() > 0); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/DataFixtures/ORM/FOSUserFixtures.php
src/Knp/IpsumBundle/DataFixtures/ORM/FOSUserFixtures.php
<?php namespace Knp\IpsumBundle\DataFixtures\ORM; use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Common\DataFixtures\AbstractFixture; use Knp\IpsumBundle\Entity\User; class FOSUserFixtures extends AbstractFixture { public function load(ObjectManager $em) { $user = new User(); $user->setUsername('john'); $user->setPlainPassword('doe'); $user->setEmail('john@doe.com'); $user->setEnabled(true); $em->persist($user); $em->flush(); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/DataFixtures/ORM/ThingFixtures.php
src/Knp/IpsumBundle/DataFixtures/ORM/ThingFixtures.php
<?php namespace Knp\IpsumBundle\DataFixtures\ORM; use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Common\DataFixtures\AbstractFixture; use Knp\IpsumBundle\Entity\Thing; use Knp\IpsumBundle\Entity\Category; class ThingFixtures extends AbstractFixture { public function load(ObjectManager $em) { $cat = new Thing(); $cat->setName('Edgar the Cat'); $bull = new Thing(); $bull->setName('Joe the bull'); $categoryRed = new Category(); $categoryRed->setName('Red'); $cat->setCategory($categoryRed); $bull->setCategory($categoryRed); for ($i = 0; $i < 20; $i++) { $thing = new Thing(); $thing->setName('Dummy thing '.$i); $thing->setCategory($categoryRed); $em->persist($thing); } $em->persist($cat); $em->persist($bull); $em->persist($categoryRed); $em->flush(); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/DataFixtures/ORM/TimedThingFixtures.php
src/Knp/IpsumBundle/DataFixtures/ORM/TimedThingFixtures.php
<?php namespace Knp\IpsumBundle\DataFixtures\ORM; use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Common\DataFixtures\AbstractFixture; use Knp\IpsumBundle\Entity\TimedThing; class TimedThingFixtures extends AbstractFixture { public function load(ObjectManager $em) { $cat = new TimedThing(); $cat->setName('Edgar the Cat'); $cat->setContent('Edgar is happy'); $bull = new TimedThing(); $bull->setName('Joe the bull'); $bull->setContent('Joe is sad'); $em->persist($cat); $em->persist($bull); $em->flush(); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/DataFixtures/MongoDB/ProductFixtures.php
src/Knp/IpsumBundle/DataFixtures/MongoDB/ProductFixtures.php
<?php namespace Knp\IpsumBundle\DataFixtures\MongoDB; use Doctrine\Common\DataFixtures\FixtureInterface; use Knp\IpsumBundle\Document\Product; use Knp\IpsumBundle\Document\Category; class ProductFixtures implements FixtureInterface { public function load($dm) { $catFood = new Product(); $catFood->setName('Cat Food'); $catToy = new Product(); $catToy->setName('Cat Toy'); $categoryCat = new Category(); $categoryCat->setName('Cat'); $catFood->setCategory($categoryCat); $catToy->setCategory($categoryCat); for ($i = 0; $i < 20; $i++) { $product = new Product(); $product->setName('Dummy product '.$i); $product->setCategory($categoryCat); $dm->persist($product); } $dm->persist($catFood); $dm->persist($catToy); $dm->persist($categoryCat); $dm->flush(); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Features/Context/FeatureContext.php
src/Knp/IpsumBundle/Features/Context/FeatureContext.php
<?php namespace Knp\IpsumBundle\Features\Context; use Symfony\Component\HttpKernel\KernelInterface; use Behat\Symfony2Extension\Context\KernelAwareInterface; use Behat\MinkExtension\Context\MinkContext; use Behat\Behat\Context\BehatContext, Behat\Behat\Exception\PendingException; use Behat\Gherkin\Node\PyStringNode, Behat\Gherkin\Node\TableNode; use Behat\Behat\Context\Step\Given; use Knp\IpsumBundle\Entity\Thing, Knp\IpsumBundle\Entity\TimedThing; require_once 'PHPUnit/Autoload.php'; require_once 'PHPUnit/Framework/Assert/Functions.php'; /** * Feature context. */ class FeatureContext extends MinkContext implements KernelAwareInterface { private $kernel; private $parameters; /** * Initializes context with parameters from behat.yml. * * @param array $parameters */ public function __construct(array $parameters) { $this->parameters = $parameters; } /** * Sets HttpKernel instance. * This method will be automatically called by Symfony2Extension ContextInitializer. * * @param KernelInterface $kernel */ public function setKernel(KernelInterface $kernel) { $this->kernel = $kernel; } /** * @Given /^I am on homepage$/ */ public function iAmOnHomepage() { return new Given('I am on "/"'); } /** * @Given /^I am on Doctrine ODM \(MongoDB\) page$/ */ public function iAmOnDoctrineODMMongoDBPage() { return new Given('I am on "/doctrine-odm"'); } /** * @Given /^I am on Doctrine ORM page$/ */ public function iAmOnDoctrineORMPage() { return new Given('I am on "/doctrine-orm"'); } /** * @Given /^I am on Form page$/ */ public function iAmOnFormPage() { return new Given('I am on "/form"'); } /** * @Given /^I am on Secured page$/ */ public function iAmOnSecuredPage() { return new Given('I am on "/secured"'); } /** * @Given /^I am not logged in$/ */ public function iAmNotLoggedIn() { $this->getMink() ->getSession() ->visit($this->locatePath('/secured/logout')) ; } /** * @Given /^there are no things in database$/ */ public function thereAreNoThingsInDatabase() { $this->getEntityManager() ->createQuery('DELETE KnpIpsumBundle:Thing') ->execute(); } /** * @Given /^there are (\d+) things in database$/ */ public function thereAreThingsInDatabase($count) { $this->thereAreNoThingsInDatabase(); $em = $this->getEntityManager(); for ($i = 0; $i < intval($count); $i++) { $thing = new Thing(); $thing->setName('Lorem #'.$i); $em->persist($thing); } $em->flush(); } /** * @Given /^there are (\d+) timed things in database$/ */ public function thereAreTimedThingsInDatabase($count) { $em = $this->getEntityManager(); $em->createQuery('DELETE KnpIpsumBundle:TimedThing') ->execute(); for ($i = 0; $i < intval($count); $i++) { $thing = new TimedThing(); $thing->setName('Lorem #'.$i); $thing->setContent('text #'.$i); $em->persist($thing); } $em->flush(); } /** * @Given /^there are no products in collection$/ */ public function thereAreNoProductsInCollection() { $this->getDocumentManager() ->createQueryBuilder('KnpIpsumBundle:Product') ->remove() ->getQuery() ->execute(); } protected function getEntityManager() { return $this->kernel->getContainer()->get('doctrine')->getEntityManager(); } protected function getDocumentManager() { return $this->kernel->getContainer()->get('doctrine.odm.mongodb.document_manager'); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/Repository/ThingRepository.php
src/Knp/IpsumBundle/Repository/ThingRepository.php
<?php namespace Knp\IpsumBundle\Repository; use Doctrine\ORM\EntityRepository; class ThingRepository extends EntityRepository { /** * Return all things whose name contains some string * Order by id desc * I know, this is heavy stuff. * * @param string $finish * @return Thing[] */ public function findAllWhoseNameContains($text) { // Note that we use a JOIN to avoid doing multiple requests // Your database will be proud of you $q = $this->createQueryBuilder('thing') ->select('thing, category') ->leftJoin('thing.category', 'category') ->where('thing.name LIKE :param') ->orderBy('thing.id', 'desc') ->getQuery() ->setParameters(array( 'param' => '%'.$text.'%', )); return $q->execute(); } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/src/Knp/IpsumBundle/EventListener/ControllerListener.php
src/Knp/IpsumBundle/EventListener/ControllerListener.php
<?php namespace Knp\IpsumBundle\EventListener; use Symfony\Component\EventDispatcher\Event; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Event\FilterControllerEvent; use Knp\IpsumBundle\Twig\Extension\IpsumExtension; class ControllerListener { protected $extension; public function __construct(IpsumExtension $extension) { $this->extension = $extension; } public function onKernelController(FilterControllerEvent $event) { if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { $this->extension->setController($event->getController()); } } }
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/web/app.php
web/app.php
<?php require_once __DIR__.'/../app/bootstrap.php.cache'; require_once __DIR__.'/../app/AppKernel.php'; //require_once __DIR__.'/../app/AppCache.php'; use Symfony\Component\HttpFoundation\Request; //$kernel = new AppCache(new AppKernel('prod', false)); $kernel = new AppKernel('prod', false); $kernel->loadClassCache(); $kernel->handle(Request::createFromGlobals())->send();
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/web/app_test.php
web/app_test.php
<?php // this check prevents access to debug front controllers that are deployed by accident to production servers. // feel free to remove this, extend it, or make something more sophisticated. if (!in_array(@$_SERVER['REMOTE_ADDR'], array( '127.0.0.1', '::1', ))) { header('HTTP/1.0 403 Forbidden'); die('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); } require_once __DIR__.'/../app/bootstrap.php.cache'; require_once __DIR__.'/../app/AppKernel.php'; use Symfony\Component\HttpFoundation\Request; $kernel = new AppKernel('test', true); $kernel->loadClassCache(); $kernel->handle(Request::createFromGlobals())->send();
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
KnpLabs/KnpIpsum
https://github.com/KnpLabs/KnpIpsum/blob/a32f0f2cb9aa4feeafa42887aac0feb27a816f7f/web/app_dev.php
web/app_dev.php
<?php // this check prevents access to debug front controllers that are deployed by accident to production servers. // feel free to remove this, extend it, or make something more sophisticated. if (!in_array(@$_SERVER['REMOTE_ADDR'], array( '127.0.0.1', '::1', ))) { header('HTTP/1.0 403 Forbidden'); die('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); } require_once __DIR__.'/../app/bootstrap.php.cache'; require_once __DIR__.'/../app/AppKernel.php'; use Symfony\Component\HttpFoundation\Request; $kernel = new AppKernel('dev', true); $kernel->loadClassCache(); $kernel->handle(Request::createFromGlobals())->send();
php
MIT
a32f0f2cb9aa4feeafa42887aac0feb27a816f7f
2026-01-05T04:41:17.232438Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/server.php
server.php
<?php /** * Laravel - A PHP Framework For Web Artisans * * @package Laravel * @author Taylor Otwell <taylor@laravel.com> */ $uri = urldecode( parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ); // This file allows us to emulate Apache's "mod_rewrite" functionality from the // built-in PHP web server. This provides a convenient way to test a Laravel // application without having installed a "real" web server software here. if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { return false; } require_once __DIR__.'/public/index.php';
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Tag.php
app/Tag.php
<?php namespace App; class Tag extends Model { /** * The database table used by the model. * * @var string */ protected $table = 'tags'; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = ['name', 'slug']; /** * Get the route key for the model. * * @return string */ public function getRouteKeyName() { return 'slug'; } /** * Get tags that have been used more than 3 times and * include that count with the tag. * * @param \Illuminate\Database\Query\Builder $query * @return \Illuminate\Database\Query\Builder */ public function scopeUsed($query) { return $query->selectRaw('tags.*, COUNT(id) AS count') ->join('post_tag', 'post_tag.tag_id', '=', 'tags.id') ->groupBy('slug'); } /** * Filter the tags by a search term. * * @param \Illuminate\Database\Query\Builder $query * @param string $search * @return \Illuminate\Database\Query\Builder */ public function scopeSearch($query, $search) { return $query->where('name', 'LIKE', "%{$search}%"); } /* |-------------------------------------------------------------------------- | Accessors and mutators |-------------------------------------------------------------------------- */ public function getHashtagAttribute() { return "#{$this->slug}"; } public function setNameAttribute($value) { $this->attributes['name'] = $value; $this->attributes['slug'] = str_slug($value); } /* |-------------------------------------------------------------------------- | Relationships |-------------------------------------------------------------------------- */ public function posts() { return $this->belongsToMany(Post::class)->withTimestamps(); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/User.php
app/User.php
<?php namespace App; use Illuminate\Auth\Authenticatable; use Illuminate\Notifications\Notifiable; use Illuminate\Auth\Passwords\CanResetPassword; use Illuminate\Foundation\Auth\Access\Authorizable; use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; class User extends Model implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract { use Authenticatable, Authorizable, CanResetPassword, Notifiable; /** * The database table used by the model. * * @var string */ protected $table = 'users'; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = ['first_name', 'last_name', 'email', 'password']; /** * The attributes excluded from the model's JSON form. * * @var array */ protected $hidden = ['password', 'remember_token']; /* |-------------------------------------------------------------------------- | Accessors and mutators |-------------------------------------------------------------------------- */ public function getFullNameAttribute() { return "{$this->first_name} {$this->last_name}"; } /* |-------------------------------------------------------------------------- | Relationships |-------------------------------------------------------------------------- */ public function posts() { return $this->hasMany(Post::class); } public function tags() { return $this->hasManyThrough(Tag::class, Post::class); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Project.php
app/Project.php
<?php namespace App; class Project extends Model { /** * The database table used by the model. * * @var string */ protected $table = 'projects'; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = ['name', 'slug', 'description', 'url']; /** * Get the route key for the model. * * @return string */ public function getRouteKeyName() { return 'slug'; } /* |-------------------------------------------------------------------------- | Scopes |-------------------------------------------------------------------------- */ public function scopeAlphabetical($query) { return $query->orderBy('name'); } /* |-------------------------------------------------------------------------- | Accessors and mutators |-------------------------------------------------------------------------- */ public function setNameAttribute($value) { $this->attributes['name'] = $value; $this->attributes['slug'] = str_slug($value); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Series.php
app/Series.php
<?php namespace App; class Series extends Model { /** * The database table used by the model. * * @var string */ protected $table = 'series'; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = ['name', 'slug', 'description']; /** * Get the route key for the model. * * @return string */ public function getRouteKeyName() { return 'slug'; } /* |-------------------------------------------------------------------------- | Scopes |-------------------------------------------------------------------------- */ public function scopeOrdered($query) { return $query->orderBy('name'); } /* |-------------------------------------------------------------------------- | Accessors and mutators |-------------------------------------------------------------------------- */ public function setNameAttribute($value) { $this->attributes['name'] = $value; $this->attributes['slug'] = str_slug($value); } /* |-------------------------------------------------------------------------- | Relationships |-------------------------------------------------------------------------- */ public function posts() { return $this->hasMany(Post::class); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Model.php
app/Model.php
<?php namespace App; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\Model as BaseModel; abstract class Model extends BaseModel { use SoftDeletes; protected $dates = ['deleted_at']; }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Post.php
app/Post.php
<?php namespace App; use Laravel\Scout\Searchable; class Post extends Model { use Searchable; /** * The database table used by the model. * * @var string */ protected $table = 'posts'; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = ['series_id', 'title', 'slug', 'content', 'published_at']; /** * The attributes that should be mutated to dates. * * @var array */ protected $dates = ['published_at', 'deleted_at']; /** * Get the route key for the model. * * @return string */ public function getRouteKeyName() { return 'slug'; } /** * Get the indexable data array for the model. * * @return array */ public function toSearchableArray() { if ($this->isPublished()) { return $this->toArray(); } return []; } public function publish() { $this->published_at = $this->freshTimestamp(); $this->save(); } /* |-------------------------------------------------------------------------- | Scopes |-------------------------------------------------------------------------- */ public function scopePublished($query) { return $query->where('published_at', '<=', $this->freshTimestamp()); } public function scopeRelated($query, Post $post) { $tags = $post->tags->modelKeys(); return $query->whereHas('tags', function ($query) use ($tags) { $query->whereIn('id', $tags); }); } /* |-------------------------------------------------------------------------- | Accessors and mutators |-------------------------------------------------------------------------- */ public function setTitleAttribute($value) { $this->attributes['title'] = $value; $this->attributes['slug'] = str_slug($value); } /* |-------------------------------------------------------------------------- | Relationships |-------------------------------------------------------------------------- */ public function isPublished() { return ! $this->isUnpublished() && $this->published_at <= $this->freshTimestamp(); } public function isUnpublished() { return is_null($this->published_at); } /* |-------------------------------------------------------------------------- | Relationships |-------------------------------------------------------------------------- */ public function series() { return $this->belongsTo(Series::class); } public function tags() { return $this->belongsToMany(Tag::class)->orderBy('name')->withTimestamps(); } public function user() { return $this->belongsTo(User::class); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Exceptions/Handler.php
app/Exceptions/Handler.php
<?php namespace App\Exceptions; use Exception; use Illuminate\Auth\AuthenticationException; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; class Handler extends ExceptionHandler { /** * A list of the exception types that are not reported. * * @var array */ protected $dontReport = [ // ]; /** * A list of the inputs that are never flashed for validation exceptions. * * @var array */ protected $dontFlash = [ 'password', 'password_confirmation', ]; /** * Report or log an exception. * * This is a great spot to send exceptions to Sentry, Bugsnag, etc. * * @param \Exception $exception * @return void */ public function report(Exception $exception) { if ($this->shouldReport($exception)) { app('sentry')->captureException($exception); } parent::report($exception); } /** * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request * @param \Exception $exception * @return \Illuminate\Http\Response */ public function render($request, Exception $exception) { return parent::render($request, $exception); } /** * Convert an authentication exception into an unauthenticated response. * * @param \Illuminate\Http\Request $request * @param \Illuminate\Auth\AuthenticationException $exception * @return \Illuminate\Http\Response */ protected function unauthenticated($request, AuthenticationException $exception) { return $request->expectsJson() ? response()->json(['message' => 'Unauthenticated.'], 401) : redirect()->guest(route('admin.sessions.create')); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Kernel.php
app/Http/Kernel.php
<?php namespace App\Http; use Illuminate\Foundation\Http\Kernel as HttpKernel; class Kernel extends HttpKernel { /** * The application's global HTTP middleware stack. * * These middleware are run during every request to your application. * * @var array */ protected $middleware = [ \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, \App\Http\Middleware\TrustProxies::class, ]; /** * The application's route middleware groups. * * @var array */ protected $middlewareGroups = [ 'web' => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, // \Illuminate\Session\Middleware\AuthenticateSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, ], 'api' => [ 'throttle:60,1', 'bindings', ], ]; /** * The application's route middleware. * * These middleware may be assigned to groups or used individually. * * @var array */ protected $routeMiddleware = [ 'auth' => \Illuminate\Auth\Middleware\Authenticate::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 'can' => \Illuminate\Auth\Middleware\Authorize::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, ]; }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Requests/Request.php
app/Http/Requests/Request.php
<?php namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; abstract class Request extends FormRequest { /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return (bool) $this->user(); } /** * Get the response for a forbidden operation. * * @return \Illuminate\Http\Response */ public function forbiddenResponse() { return $this->redirector->route('admin.sessions.create'); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Requests/Projects/UpdateProjectRequest.php
app/Http/Requests/Projects/UpdateProjectRequest.php
<?php namespace App\Http\Requests\Projects; use App\Http\Requests\Request; use Illuminate\Validation\Rule; class UpdateProjectRequest extends Request { /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $project = $this->route()->parameter('project'); return [ 'slug' => Rule::unique('projects')->ignore($project->getKey()), 'url' => 'url' ]; } /** * Get the URL to redirect to on a validation error. * * @return string */ protected function getRedirectUrl() { $url = $this->redirector->getUrlGenerator(); $project = $this->route()->parameter('project'); return $url->route('admin.projects.edit', $project); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Requests/Projects/StoreProjectRequest.php
app/Http/Requests/Projects/StoreProjectRequest.php
<?php namespace App\Http\Requests\Projects; use App\Http\Requests\Request; use Illuminate\Validation\Rule; class StoreProjectRequest extends Request { /** * The route to redirect to if validation fails. * * @var string */ protected $redirectRoute = 'admin.projects.create'; /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'name' => 'required', 'slug' => ['required', Rule::unique('projects')], 'description' => 'required', 'url' => 'url' ]; } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Requests/Users/UpdateUserRequest.php
app/Http/Requests/Users/UpdateUserRequest.php
<?php namespace App\Http\Requests\Users; use App\Http\Requests\Request; use Illuminate\Validation\Rule; class UpdateUserRequest extends Request { /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $user = $this->route()->parameter('user'); return [ 'email' => ['email', Rule::unique('users')->ignore($user->getKey())] ]; } /** * Get the URL to redirect to on a validation error. * * @return string */ protected function getRedirectUrl() { $url = $this->redirector->getUrlGenerator(); $user = $this->route()->parameter('user'); return $url->route('admin.users.edit', $user); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Requests/Users/StoreUserRequest.php
app/Http/Requests/Users/StoreUserRequest.php
<?php namespace App\Http\Requests\Users; use App\Http\Requests\Request; use Illuminate\Validation\Rule; class StoreUserRequest extends Request { /** * The route to redirect to if validation fails. * * @var string */ protected $redirectRoute = 'admin.users.create'; /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'first_name' => 'required', 'last_name' => 'required', 'email' => ['required', 'email', Rule::unique('users')], 'password' => 'required' ]; } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Requests/Tags/StoreTagRequest.php
app/Http/Requests/Tags/StoreTagRequest.php
<?php namespace App\Http\Requests\Tags; use App\Http\Requests\Request; use Illuminate\Http\JsonResponse; class StoreTagRequest extends Request { /** * The route to redirect to if validation fails. * * @var string */ protected $redirectRoute = 'admin.posts.create'; /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'name' => 'required' ]; } /** * Get the proper failed validation response for the request. * * @param array $errors * @return \Symfony\Component\HttpFoundation\Response */ public function response(array $errors) { return new JsonResponse($errors, 422); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Requests/Series/StoreSeriesRequest.php
app/Http/Requests/Series/StoreSeriesRequest.php
<?php namespace App\Http\Requests\Series; use App\Http\Requests\Request; use Illuminate\Validation\Rule; class StoreSeriesRequest extends Request { /** * The route to redirect to if validation fails. * * @var string */ protected $redirectRoute = 'admin.series.create'; /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'name' => 'required', 'slug' => ['required', Rule::unique('series')], 'description' => 'required' ]; } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Requests/Series/UpdateSeriesRequest.php
app/Http/Requests/Series/UpdateSeriesRequest.php
<?php namespace App\Http\Requests\Series; use App\Http\Requests\Request; use Illuminate\Validation\Rule; class UpdateSeriesRequest extends Request { /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $series = $this->route()->parameter('series'); return [ 'slug' => Rule::unique('series')->ignore($series->getKey()) ]; } /** * Get the URL to redirect to on a validation error. * * @return string */ protected function getRedirectUrl() { $url = $this->redirector->getUrlGenerator(); $series = $this->route()->parameter('series'); return $url->route('admin.series.edit', $series); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Requests/Posts/UpdatePostRequest.php
app/Http/Requests/Posts/UpdatePostRequest.php
<?php namespace App\Http\Requests\Posts; use App\Http\Requests\Request; use Illuminate\Validation\Rule; class UpdatePostRequest extends Request { /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $post = $this->route()->parameter('post'); return [ 'series_id' => ['nullable', Rule::exists('series', 'id')], 'slug' => Rule::unique('posts')->ignore($post->getKey()) ]; } /** * Get the URL to redirect to on a validation error. * * @return string */ protected function getRedirectUrl() { $url = $this->redirector->getUrlGenerator(); $post = $this->route()->parameter('post'); return $url->route('admin.posts.edit', $post); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Requests/Posts/StorePostRequest.php
app/Http/Requests/Posts/StorePostRequest.php
<?php namespace App\Http\Requests\Posts; use App\Http\Requests\Request; use Illuminate\Validation\Rule; class StorePostRequest extends Request { /** * The route to redirect to if validation fails. * * @var string */ protected $redirectRoute = 'admin.posts.create'; /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'series_id' => ['nullable', Rule::exists('series', 'id')], 'title' => 'required', 'slug' => ['required', Rule::unique('posts')], 'content' => 'required' ]; } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Controllers/ProjectsController.php
app/Http/Controllers/ProjectsController.php
<?php namespace App\Http\Controllers; use App\Project; use Illuminate\Http\Request; class ProjectsController extends Controller { /** * GET /projects * Get a listing of all projects. * * @param \Illuminate\Http\Request $request * @return \Illuminate\View\View */ public function index(Request $request) { $projects = Project::alphabetical()->paginate(25); $page = $request->get('page'); $title = $page ? "All projects (Page {$page})" : 'All projects'; return view('projects.index', compact('projects')) ->withTitle($title); } /** * GET /projects/project-slug * Get a single project. * * @param \App\Project $project * @return \Illuminate\View\View */ public function show(Project $project) { return view('projects.show', compact('project')) ->withTitle($project->name) ->withDescription(str_limit($project->description, 160)); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Controllers/PostsController.php
app/Http/Controllers/PostsController.php
<?php namespace App\Http\Controllers; use App\Post; use Illuminate\Http\Request; class PostsController extends Controller { /** * GET /posts * Get a listing of all posts. * * @param \Illuminate\Http\Request $request * @return \Illuminate\View\View */ public function index(Request $request) { $posts = Post::with('tags', 'series') ->published() ->latest() ->paginate(10); $page = $request->get('page'); $title = $page ? "All posts (Page {$page})" : 'All posts'; return view('posts.index', compact('posts')) ->withTitle($title); } /** * GET /posts/post-slug * Get a single post. * * @param \App\Post $post * @return \Illuminate\View\View */ public function show(Post $post) { abort_unless($post->isPublished(), 404); $post->load('series', 'tags', 'user'); $post->increment('views'); return view('posts.show', compact('post')) ->withTitle($post->title) ->withDescription(str_limit($post->content, 160)); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Controllers/Controller.php
app/Http/Controllers/Controller.php
<?php namespace App\Http\Controllers; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Routing\Controller as BaseController; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; class Controller extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Controllers/PagesController.php
app/Http/Controllers/PagesController.php
<?php namespace App\Http\Controllers; use App\Post; class PagesController extends Controller { /** * GET / * The home page. * * @return \Illuminate\View\View */ public function index() { $latestPosts = Post::with('tags')->published()->latest()->take(5)->get(); $popularPosts = Post::published() ->with('tags') ->whereNotIn('id', $latestPosts->modelKeys()) ->orderBy('views', 'desc') ->take(5) ->get(); return view('pages.index', compact('latestPosts', 'popularPosts')) ->withTitle('A blog on Laravel & Rails'); } /** * GET /about * The about page. * * @return \Illuminate\View\View */ public function about() { return view('pages.about') ->withTitle('About'); } /** * GET /rss * Return the RSS feed of posts. * * @return \Illuminate\Http\Response */ public function rss() { $posts = Post::published()->latest()->take(100)->get(); if ($posts->count()) { $updated = $posts->first()->updated_at; } return response()->view('pages.rss', compact('posts', 'updated'), 200, [ 'Content-Type' => 'application/rss+xml; charset=UTF-8' ]); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Controllers/SitemapsController.php
app/Http/Controllers/SitemapsController.php
<?php namespace App\Http\Controllers; use Sitemap; use App\Post; use App\Project; use App\Series; class SitemapsController extends Controller { /** * GET /sitemap * Return the sitemap. * * @return \Illuminate\Http\Response */ public function index() { Sitemap::addTag(route('pages.about')); $this->getPosts(); $this->getProjects(); $this->getSeries(); return Sitemap::renderSitemap(); } /** * Get the latest published posts. * * @param int $limit * @return void */ protected function getPosts($limit = null) { $posts = Post::published()->latest()->take($limit)->get(); foreach ($posts as $post) { Sitemap::addTag( route('posts.show', $post), $post, 'daily', '0.9' ); } } /** * Get the projects. * * @param int $limit * @return void */ protected function getProjects($limit = null) { $projects = Project::alphabetical()->take($limit)->get(); foreach ($projects as $project) { Sitemap::addTag( route('projects.show', $project), $project, 'weekly', '0.8' ); } } /** * Get the series. * * @param int $limit * @return void */ protected function getSeries($limit = null) { $series = Series::whereHas('posts', function ($query) { $query->published(); }) ->take($limit) ->get(); foreach ($series as $singleSeries) { Sitemap::addTag( route('series.show', $singleSeries), $singleSeries, 'weekly', '0.8' ); } } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Controllers/SeriesController.php
app/Http/Controllers/SeriesController.php
<?php namespace App\Http\Controllers; use App\Series; use Illuminate\Http\Request; class SeriesController extends Controller { /** * GET /series * Get a listing of all series. * * @param \Illuminate\Http\Request $request * @return \Illuminate\View\View */ public function index(Request $request) { $series = Series::whereHas('posts', function ($query) { $query->published(); })->paginate(25); $page = $request->get('page'); $title = $page ? "All series (Page {$page})" : 'All series'; return view('series.index', compact('series')) ->withTitle($title); } /** * GET /series/series-slug * Get a single series. * * @param \App\Series $series * @return \Illuminate\View\View */ public function show(Series $series) { $posts = $series->posts()->published()->paginate(); return view('series.show', compact('series', 'posts')) ->withTitle($series->name) ->withDescription(str_limit($series->description, 160)); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Controllers/TagsController.php
app/Http/Controllers/TagsController.php
<?php namespace App\Http\Controllers; use App\Tag; class TagsController extends Controller { /** * GET /tags * Display a listing of all tags. * * @return \Illuminate\View\View */ public function index() { $tags = Tag::used()->get(); foreach ($tags as $tag) { $taggly[] = [ 'tag' => $tag->name, 'url' => route('tags.show', $tag->slug), 'count' => $tag->count ]; } return view('tags.index', compact('tags', 'taggly')) ->withTitle('All tags'); } /** * GET /tags/tag * Display the posts of a given tag. * * @param \App\Tag $tag * @return \Illuminate\View\View */ public function show(Tag $tag) { $posts = $tag->posts()->published()->latest()->paginate(); return view('tags.show', compact('tag', 'posts')) ->withTitle("Posts for {$tag->name}"); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Controllers/RedirectsController.php
app/Http/Controllers/RedirectsController.php
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; class RedirectsController extends Controller { /* |-------------------------------------------------------------------------- | General redirects |-------------------------------------------------------------------------- */ /** * GET /post/post-slug * Redirect legacy post routes to the new pluralised route. * * @param string $slug * @return \Illuminate\Http\RedirectResponse */ public function getPost($slug) { return redirect()->route('posts.show', $slug, 301); } /** * GET /tag/tag-slug * Redirect legacy tag routes to the new pluralised route. * * @param string $slug * @return \Illuminate\Http\RedirectResponse */ public function getTag($slug) { return redirect()->route('tags.show', $slug, 301); } /** * GET /archive * Redirect legacy archive routes to the new posts route. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\RedirectResponse */ public function getArchive(Request $request) { $parameters = []; if ($request->has('page')) { $parameters['page'] = $request->get('page'); } return redirect()->route('posts.index', $parameters, 301); } /* |-------------------------------------------------------------------------- | Specific redirects |-------------------------------------------------------------------------- */ public function getTagsMacOsX() { return redirect()->to('tags/osx'); } public function getTagsRubyOnRails() { return redirect()->to('tags/ruby-on-rails'); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Controllers/Admin/ProjectsController.php
app/Http/Controllers/Admin/ProjectsController.php
<?php namespace App\Http\Controllers\Admin; use App\Project; use App\Http\Requests\Projects\StoreProjectRequest; use App\Http\Requests\Projects\UpdateProjectRequest; class ProjectsController extends Controller { /** * GET /admin/projects * Display all of the projects. * * @return \Illuminate\View\View */ public function index() { $projects = Project::latest()->paginate(25); return view('admin.projects.index', compact('projects')) ->withTitle('All projects'); } /** * GET /admin/projects/create * Display the form for creating a new project. * * @return \Illuminate\View\View */ public function create() { return view('admin.projects.create') ->withTitle('Create projects'); } /** * POST /admin/projects * Store a new project in storage. * * @param \App\Http\Requests\Projects\StoreProjectRequest $request * @return \Illuminate\Http\RedirectResponse */ public function store(StoreProjectRequest $request) { $project = Project::create($request->all()); return redirect()->route('admin.projects.show', $project) ->withSuccess('The project was created.'); } /** * GET /admin/projects/project-slug * Display a specified project. * * @param \App\Project $project * @return \Illuminate\View\View */ public function show(Project $project) { return view('admin.projects.show', compact('project')) ->withTitle('Show project'); } /** * GET /admin/projects/project-slug/edit * Display the form for editing a project. * * @param \App\Project $project * @return \Illuminate\View\View */ public function edit(Project $project) { return view('admin.projects.edit', compact('project')) ->withTitle('Edit project'); } /** * PUT /admin/projects/project-slug * Update a given project in storage. * * @param \App\Project $request * @param \App\Http\Requests\Projects\UpdateProjectRequest $project * @return \Illuminate\Http\RedirectResponse */ public function update(Project $project, UpdateProjectRequest $request) { $project->update($request->all()); return redirect()->route('admin.projects.show', $project) ->withSuccess('The project was updated.'); } /** * DELETE /admin/projects/project-slug * Remove a project from storage. * * @param \App\Project $project * @return \Illuminate\Http\RedirectResponse */ public function destroy(Project $project) { $project->delete(); return redirect()->route('admin.projects.index') ->withSuccess('The project was deleted.'); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Controllers/Admin/PostsController.php
app/Http/Controllers/Admin/PostsController.php
<?php namespace App\Http\Controllers\Admin; use App\Tag; use App\Post; use App\Series; use App\Http\Requests\Posts\StorePostRequest; use App\Http\Requests\Posts\UpdatePostRequest; class PostsController extends Controller { /** * GET /admin/posts * Display all of the posts. * * @return \Illuminate\View\View */ public function index() { $posts = Post::with('user') ->latest() ->paginate(25); return view('admin.posts.index', compact('posts')) ->withTitle('All posts'); } /** * GET /admin/posts/create * Display the form for creating a new post. * * @return \Illuminate\View\View */ public function create() { $series = Series::ordered()->get(); return view('admin.posts.create', compact('series')) ->withTitle('Create post'); } /** * POST /admin/posts * Store a new post in storage. * * @param \App\Http\Requests\Posts\StorePostRequest $request * @return \Illuminate\Http\RedirectResponse */ public function store(StorePostRequest $request) { $post = $request->user()->posts()->create($request->all()); $post->tags()->sync( Tag::whereIn('name', explode(',', $request->tags))->pluck('id')->all() ); return redirect()->route('admin.posts.show', $post) ->withSuccess('The post was created.'); } /** * GET /admin/posts/post-slug * Display a specified post. * * @param \App\Post $post * @return \Illuminate\View\View */ public function show(Post $post) { return view('admin.posts.show', compact('post')) ->withTitle('Show post'); } /** * GET /admin/posts/post-slug/edit * Display the form for editing a post. * * @param \App\Post $post * @return \Illuminate\View\View */ public function edit(Post $post) { $series = Series::ordered()->get(); return view('admin.posts.edit', compact('post', 'series')) ->withTitle('Edit post'); } /** * PUT /admin/posts/post-slug * Update a given post in storage. * * @param \App\Post $post * @param \App\Http\Requests\Posts\UpdatePostRequest $request * @return \Illuminate\Http\RedirectResponse */ public function update(Post $post, UpdatePostRequest $request) { $post->update($request->all()); $post->tags()->sync( Tag::whereIn('name', explode(',', $request->tags))->pluck('id')->all() ); return redirect()->route('admin.posts.show', $post) ->withSuccess('The post was updated.'); } /** * DELETE /admin/posts/post-slug * Remove a post from storage. * * @param \App\Post $post * @return \Illuminate\Http\RedirectResponse */ public function destroy(Post $post) { $post->delete(); return redirect()->route('admin.posts.index') ->withSuccess('The post was deleted.'); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Controllers/Admin/Controller.php
app/Http/Controllers/Admin/Controller.php
<?php namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller as BaseController; abstract class Controller extends BaseController { /** * Construct the controller. * * @return void */ public function __construct() { $this->middleware('auth'); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Controllers/Admin/PagesController.php
app/Http/Controllers/Admin/PagesController.php
<?php namespace App\Http\Controllers\Admin; use App\Post; use App\User; use App\Series; use App\Project; class PagesController extends Controller { /** * GET /admin/users * Display a listing of users. * * @return \Illuminate\View\View */ public function index() { $postsCount = Post::count(); $seriesCount = Series::count(); $projectsCount = Project::count(); $usersCount = User::count(); return view('admin.pages.index', compact('postsCount', 'seriesCount', 'projectsCount', 'usersCount')) ->withTitle('Admin'); } /** * GET /admin/reports * Display statistic reports. * * @return \Illuminate\View\View */ public function reports() { return view('admin.pages.reports') ->withTitle('Reports'); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Controllers/Admin/SessionsController.php
app/Http/Controllers/Admin/SessionsController.php
<?php namespace App\Http\Controllers\Admin; use Validator; use Illuminate\Contracts\Auth\Guard; use Illuminate\Http\Request; class SessionsController extends Controller { /** * Construct the controller. * * @return void */ public function __construct() { $this->middleware('auth', ['only' => 'destroy']); } /** * GET /admin/login * Display the form for logging in a user. * * @return \Illuminate\View\View */ public function create() { return view('admin.sessions.create') ->withTitle('Login'); } /** * POST /admin/login * Attempt to login a user. * * @param \Illuminate\Http\Request $request * @param \Illuminate\Contracts\Auth\Guard $auth * @return \Illuminate\Http\RedirectResponse */ public function store(Request $request, Guard $auth) { $this->validate($request, [ 'email' => ['required', 'email', 'exists:users'], 'password' => 'required' ]); // Attempt to login and remember the user. if ($auth->attempt($request->only('email', 'password'), true)) { return redirect()->intended(route('admin.pages.index')); } return redirect()->route('admin.sessions.create') ->withError('Your login credentials were invalid.') ->withInput($request->except('password')); } /** * DELETE /admin/logout * Log out a user. * * @param \Illuminate\Contracts\Auth\Guard $auth * @return \Illuminate\Http\RedirectResponse */ public function destroy(Guard $auth) { $auth->logout(); return redirect()->route('admin.sessions.create') ->withSuccess('You have been logged out.'); } /** * Get the URL we should redirect to. * * @return string */ protected function getRedirectUrl() { return route('admin.sessions.create'); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Controllers/Admin/SeriesController.php
app/Http/Controllers/Admin/SeriesController.php
<?php namespace App\Http\Controllers\Admin; use App\Series; use App\Http\Requests\Series\StoreSeriesRequest; use App\Http\Requests\Series\UpdateSeriesRequest; class SeriesController extends Controller { /** * GET /admin/series * Display all of the series. * * @return \Illuminate\View\View */ public function index() { $series = Series::with('posts') ->latest() ->paginate(25); return view('admin.series.index', compact('series')) ->withTitle('All series'); } /** * GET /admin/series/create * Display the form for creating a new series. * * @return \Illuminate\View\View */ public function create() { return view('admin.series.create') ->withTitle('Create series'); } /** * POST /admin/series * Store a new series in storage. * * @param \App\Http\Requests\Series\StoreSeriesRequest $request * @return \Illuminate\Http\RedirectResponse */ public function store(StoreSeriesRequest $request) { $series = Series::create($request->all()); return redirect()->route('admin.series.show', $series) ->withSuccess('The series was created.'); } /** * GET /admin/series/series-slug * Display a specified series. * * @param \App\Series $series * @return \Illuminate\View\View */ public function show(Series $series) { return view('admin.series.show', compact('series')) ->withTitle('Show series'); } /** * GET /admin/series/series-slug/edit * Display the form for editing a series. * * @param \App\Series $series * @return \Illuminate\View\View */ public function edit(Series $series) { return view('admin.series.edit', compact('series')) ->withTitle('Edit series'); } /** * PUT /admin/series/series-slug * Update a given series in storage. * * @param \App\Series $series * @param \App\Http\Requests\Series\UpdateSeriesRequest $request * @return \Illuminate\Http\RedirectResponse */ public function update(Series $series, UpdateSeriesRequest $request) { $series->update($request->all()); return redirect()->route('admin.series.show', $series) ->withSuccess('The series was updated.'); } /** * DELETE /admin/series/series-slug * Remove a series from storage. * * @param \App\Series $series * @return \Illuminate\Http\RedirectResponse */ public function destroy(Series $series) { $series->delete(); return redirect()->route('admin.series.index') ->withSuccess('The series was deleted.'); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Controllers/Admin/TagsController.php
app/Http/Controllers/Admin/TagsController.php
<?php namespace App\Http\Controllers\Admin; use App\Tag; use Illuminate\Http\Request; use App\Http\Requests\Tags\StoreTagRequest; class TagsController extends Controller { /** * GET /admin/tags * Display all of the tags. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\JsonResponse */ public function index(Request $request) { $tags = Tag::query(); if ($request->has('q')) { $tags->search($request->input('q')); } return response()->json($tags->get()); } /** * POST /admin/tags * Store a new tag in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\JsonResponse */ public function store(StoreTagRequest $request) { $tag = Tag::firstOrCreate([ 'name' => $request->input('name'), 'slug' => str_slug($request->input('name')) ]); return response()->json($tag, 201); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Controllers/Admin/UsersController.php
app/Http/Controllers/Admin/UsersController.php
<?php namespace App\Http\Controllers\Admin; use App\User; use App\Http\Requests\Users\StoreUserRequest; use App\Http\Requests\Users\UpdateUserRequest; class UsersController extends Controller { /** * GET /admin/users * Display all of the users. * * @return \Illuminate\View\View */ public function index() { $users = User::latest()->paginate(25); return view('admin.users.index', compact('users')) ->withTitle('All users'); } /** * GET /admin/users/create * Display the form for creating a new user. * * @return \Illuminate\View\View */ public function create() { return view('admin.users.create') ->withTitle('Create user'); } /** * POST /admin/users * Store a new user in storage. * * @param \App\Http\Requests\Users\StoreUserRequest $request * @return \Illuminate\Http\RedirectResponse */ public function store(StoreUserRequest $request) { $user = User::create($request->all()); return redirect()->route('admin.users.show', $user) ->withSuccess('The user was created.'); } /** * GET /admin/users/id * Display a specified user. * * @param \App\User $user * @return \Illuminate\View\View */ public function show(User $user) { return view('admin.users.show', compact('user')) ->withTitle('Show user'); } /** * GET /admin/users/id/edit * Display the form for editing a user. * * @param \App\User $user * @return \Illuminate\View\View */ public function edit(User $user) { return view('admin.users.edit', compact('user')) ->withTitle('Edit user'); } /** * PUT /admin/users/id * Update a given user in storage. * * @param \App\User $user * @param \App\Http\Requests\Users\UpdateUserRequest $request * @return \Illuminate\Http\RedirectResponse */ public function update(User $user, UpdateUserRequest $request) { $user->update($request->all()); return redirect()->route('admin.users.show', $user) ->withSuccess('The user was updated'); } /** * DELETE /admin/users/id * Remove a user from storage. * * @param \App\User $user * @return \Illuminate\Http\RedirectResponse */ public function destroy(User $user) { $user->delete(); return redirect()->route('admin.users.index') ->withSuccess('The user was deleted.'); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Middleware/RedirectIfAuthenticated.php
app/Http/Middleware/RedirectIfAuthenticated.php
<?php namespace App\Http\Middleware; use Closure; use Illuminate\Support\Facades\Auth; class RedirectIfAuthenticated { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string|null $guard * @return mixed */ public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->check()) { return redirect('/'); } return $next($request); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Middleware/TrustProxies.php
app/Http/Middleware/TrustProxies.php
<?php namespace App\Http\Middleware; use Illuminate\Http\Request; use Fideloper\Proxy\TrustProxies as Middleware; class TrustProxies extends Middleware { /** * The trusted proxies for this application. * * @var array */ protected $proxies; /** * The headers that should be used to detect proxies. * * @var string */ protected $headers = Request::HEADER_X_FORWARDED_ALL; }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Middleware/TrimStrings.php
app/Http/Middleware/TrimStrings.php
<?php namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware; class TrimStrings extends Middleware { /** * The names of the attributes that should not be trimmed. * * @var array */ protected $except = [ 'password', 'password_confirmation', ]; }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Middleware/EncryptCookies.php
app/Http/Middleware/EncryptCookies.php
<?php namespace App\Http\Middleware; use Illuminate\Cookie\Middleware\EncryptCookies as Middleware; class EncryptCookies extends Middleware { /** * The names of the cookies that should not be encrypted. * * @var array */ protected $except = [ // ]; }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Http/Middleware/VerifyCsrfToken.php
app/Http/Middleware/VerifyCsrfToken.php
<?php namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware; class VerifyCsrfToken extends Middleware { /** * The URIs that should be excluded from CSRF verification. * * @var array */ protected $except = [ // ]; }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Support/helpers.php
app/Support/helpers.php
<?php use Illuminate\Support\HtmlString; if (! function_exists('markdown')) { /** * Convert Markdown into HTML. * * @param string $markdown * @return string */ function markdown($markdown) { $compiled = (new Parsedown)->text($markdown); return new HtmlString($compiled); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Console/Kernel.php
app/Console/Kernel.php
<?php namespace App\Console; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; class Kernel extends ConsoleKernel { /** * The Artisan commands provided by your application. * * @var array */ protected $commands = [ // ]; /** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { // $schedule->command('inspire') // ->hourly(); } /** * Register the commands for the application. * * @return void */ protected function commands() { $this->load(__DIR__.'/Commands'); require base_path('routes/console.php'); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Providers/BroadcastServiceProvider.php
app/Providers/BroadcastServiceProvider.php
<?php namespace App\Providers; use Illuminate\Support\ServiceProvider; use Illuminate\Support\Facades\Broadcast; class BroadcastServiceProvider extends ServiceProvider { /** * Bootstrap any application services. * * @return void */ public function boot() { Broadcast::routes(); require base_path('routes/channels.php'); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Providers/RouteServiceProvider.php
app/Providers/RouteServiceProvider.php
<?php namespace App\Providers; use Illuminate\Support\Facades\Route; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; class RouteServiceProvider extends ServiceProvider { /** * This namespace is applied to your controller routes. * * In addition, it is set as the URL generator's root namespace. * * @var string */ protected $namespace = 'App\Http\Controllers'; /** * Define your route model bindings, pattern filters, etc. * * @return void */ public function boot() { // parent::boot(); } /** * Define the routes for the application. * * @return void */ public function map() { $this->mapApiRoutes(); $this->mapWebRoutes(); // } /** * Define the "web" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapWebRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/web.php')); } /** * Define the "api" routes for the application. * * These routes are typically stateless. * * @return void */ protected function mapApiRoutes() { Route::prefix('api') ->middleware('api') ->namespace($this->namespace) ->group(base_path('routes/api.php')); } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Providers/EventServiceProvider.php
app/Providers/EventServiceProvider.php
<?php namespace App\Providers; use Illuminate\Support\Facades\Event; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; class EventServiceProvider extends ServiceProvider { /** * The event listener mappings for the application. * * @var array */ protected $listen = [ 'App\Events\Event' => [ 'App\Listeners\EventListener', ], ]; /** * Register any events for your application. * * @return void */ public function boot() { parent::boot(); // } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Providers/AppServiceProvider.php
app/Providers/AppServiceProvider.php
<?php namespace App\Providers; use Form; use Illuminate\Support\HtmlString; use Illuminate\Support\ViewErrorBag; use Laravel\Dusk\DuskServiceProvider; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider { /** * Bootstrap any application services. * * @return void */ public function boot() { if ($this->app->environment('local', 'testing')) { $this->app->register(DuskServiceProvider::class); } Form::macro('hasErrors', function ($names, $class = 'has-error') { foreach ((array) $names as $name) { if (session()->get('errors', new ViewErrorBag)->has($name)) { return $class; } } }); Form::macro('errors', function ($name, $format = '<span class="help-block">:message</span>') { return new HtmlString(session()->get('errors', new ViewErrorBag)->first($name, $format)); }); } /** * Register any application services. * * @return void */ public function register() { // } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/app/Providers/AuthServiceProvider.php
app/Providers/AuthServiceProvider.php
<?php namespace App\Providers; use Illuminate\Support\Facades\Gate; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; class AuthServiceProvider extends ServiceProvider { /** * The policy mappings for the application. * * @var array */ protected $policies = [ 'App\Model' => 'App\Policies\ModelPolicy', ]; /** * Register any authentication / authorization services. * * @return void */ public function boot() { $this->registerPolicies(); // } }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/bootstrap/app.php
bootstrap/app.php
<?php /* |-------------------------------------------------------------------------- | Create The Application |-------------------------------------------------------------------------- | | The first thing we will do is create a new Laravel application instance | which serves as the "glue" for all the components of Laravel, and is | the IoC container for the system binding all of the various parts. | */ $app = new Illuminate\Foundation\Application( realpath(__DIR__.'/../') ); /* |-------------------------------------------------------------------------- | Bind Important Interfaces |-------------------------------------------------------------------------- | | Next, we need to bind some important interfaces into the container so | we will be able to resolve them when needed. The kernels serve the | incoming requests to this application from both the web and CLI. | */ $app->singleton( Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class ); $app->singleton( Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class ); $app->singleton( Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class ); /* |-------------------------------------------------------------------------- | Return The Application |-------------------------------------------------------------------------- | | This script returns the application instance. The instance is given to | the calling script so we can separate the building of the instances | from the actual running of the application and sending responses. | */ return $app;
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false
dwightwatson/neontsunami-laravel
https://github.com/dwightwatson/neontsunami-laravel/blob/fb39bdca9f6f7794d010e1229f26ea69419af1ec/tests/TestCase.php
tests/TestCase.php
<?php namespace Tests; use Illuminate\Foundation\Testing\TestCase as BaseTestCase; abstract class TestCase extends BaseTestCase { use CreatesApplication; }
php
MIT
fb39bdca9f6f7794d010e1229f26ea69419af1ec
2026-01-05T04:41:26.570282Z
false