Ejemplo n.º 1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $string = String::findHashidOrFail($id);
     if (count($string) > 1) {
         return $this->response->collection($string, new StringTransformer());
     }
     return $this->response->item($string, new StringTransformer());
 }
Ejemplo n.º 2
0
 protected function makeString($uri, $key, $value, $plural = null, $comment = null, $placeholders = null)
 {
     $source_id = $this->source->id;
     $locale = $this->locale;
     $uri = String::makeUri($uri);
     $string = String::firstOrNew(compact('locale', 'uri', 'source_id'));
     $string->fill(compact('key', 'value', 'plural', 'comment', 'placeholders'))->save();
     $this->strings[] = $string;
     return $this;
 }
Ejemplo n.º 3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('sources')->delete();
     DB::table('strings')->delete();
     $source = ['locale' => 'en', 'format' => 'twine', 'path' => null];
     $source = Source::create($source);
     $strings = ['save' => 'Save', 'load' => 'Load', 'new' => 'New', 'open' => 'Open', 'close' => 'Close', 'ok' => 'OK', 'cancel' => 'Cancel', 'delete' => 'Delete'];
     foreach ($strings as $key => $value) {
         $string = ['key' => $key, 'uri' => 'basic.' . $key, 'value' => $value, 'locale' => 'en', 'source_id' => $source->id];
         $string = String::create($string);
     }
 }
Ejemplo n.º 4
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     $user = Auth::user() ?: User::whereEmail('system@twine')->first();
     Repository::creating(function ($model) use($user) {
         $model->created_by = $user->id;
     });
     Project::creating(function ($model) use($user) {
         $model->created_by = $user->id;
     });
     String::creating(function ($model) use($user) {
         $model->created_by = $user->id;
     });
     Source::creating(function ($model) use($user) {
         $model->created_by = $user->id;
     });
 }